''' Copyright (C) 2011 by Aurora Pariseau Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software; the original author's name is included and/or given credit in all copies of the software; a copy of this license is included with the software. Permission is denied to merge, publish, distribute, sublicense, and/or sell copies of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ''' from __future__ import with_statement import es, os.path, cPickle, popuplib, random, spe, gamethread, time, cfglib info = es.AddonInfo() info.name = "World of Hell: Diablo" info.version = "0.1.r1234" info.author = "Aurora Pariseau" info.url = "http://addons.eventscripts.com/addons/view/wohd" info.description = 'Players gain abilities through a class and random items!' es.ServerVar('wohd_version',info.version,'World of Hell: Diablo By: %s'%info.author).makepublic() # NO NEED TO OPEN THIS SCRIPT TO CHANGE SETTINGS # AFTER LOADING, EDIT THE "wohd.CFG" FILE IN THE wohd FOLDER, THEN RESTART SERVER '''''''''''''''''''''''''''''''''''''''''''''''' config = cfglib.AddonCFG(es.getAddonPath("wohd") + "/wohd.cfg") config.text("******************************") config.text(" WORLD OF HELL SETTINGS") config.text("*****************************") config.text("Be careful when setting the names of commands so that they do not interfere") config.text("with other scripts you are running") config.text("******************************") wohd_menuCommand = config.cvar("wohd_menu", "/menu", "Text used to open the menu") wohd_resetAbilities = config.cvar("wohd_reset", "/reset", "Command used for a player to reset their abilities") wohd_resetEverything = config.cvar("wohd_global_reset", "/wohd_default", "Command used to restart EVERYONES abilities, requires RCON") wohd_killExp = config.cvar("wohd_exp", 50, "Amount of XP Gained for each kill") wohd_roundExp = config.cvar("wohd_roundExp", 40, "Amount of XP Gained for winning the round") wohd_bomb_plantedExp = config.cvar("wohd_plantedExp", 25, "Amount of XP Gained for planting the bomb") wohd_bomb_explodedExp = config.cvar("wohd_explodedExp", 25, "Amount of XP Gained for the bomb exploding") wohd_bomb_defusedExp = config.cvar("wohd_defusedExp", 50, "Amount of XP Gained for defusing the bomb") wohd_rescueExp = config.cvar("wohd_rescueExp", 10, "Amount of XP Gained for rescuing a hostage") wohd_allExp = config.cvar("wohd_allExp", 10, "Amount of XP Gained for rescuing all hostages") wohd_experiencePerLevel = config.cvar("wohd_experiencePerLevel", 2000, "The experience needed to get to the next level multipled by current level; wohd_experiencePerLevel X Current Level = experience needed for next level") wohd_levelCap = config.cvar("wohd_levelCap", 99, "The maximum level someone can achieve") wohd_skillPerLevel = config.cvar("wohd_skillPerLevel", 1, "The number of skills per level a player earns") config.write() # DO NOT EDIT BELOW THIS LINE OR THINGS MAY BREAK es.ServerVar('wohd_debug', 0) players = {} classes = [ 'Amazon', 'Barbarian', 'Druid', 'Paladin', 'Sorceror', 'Witch Doctor' ] items = [ 'Weapon', 'Armor', 'Ring', 'Amulet', 'Runestone', 'Jewel', 'Gem' ] def changeTeam(userid, newTeam, classId=0): '''Changes a player to a new team.''' if not es.exists('userid', userid): raise ValueError('userid (%s) doesn\'t exist.' % userid) # Change to new team es.changeteam(userid, newTeam) # No need to set class and hide menus if we aren't joining an active team if newTeam not in (2, 3): return # Get a random class if classId == 0: classId = random.randint(1, 4) # Terrorist if newteam == 2: es.setplayerprop(userid, 'CCSPlayer.m_iClass', classId) usermsg.showVGUIPanel(userid, 'class_ter', False, {}) # Counter-Terrorist else: es.setplayerprop(userid, 'CCSPlayer.m_iClass', classId+4) usermsg.showVGUIPanel(userid, 'class_ct', False, {}) def debug(message): if es.ServerVar('wohd_debug') == 1: es.msg('#multi', '#default', '[DIABLO]', '#green', message) def wohdMsg(message): es.msg('#multi', '#default', '[DIABLO]', '#green', message) def wohdTell(userid, message): es.tell(userid, '#multi', '#default', '[DIABLO]', '#green', message) def load(): config.execute() global players, round_started, unlocks round_started = 0 str_path = es.getAddonPath('wohd') + '/wohd.db' if os.path.isfile(str_path): file_users = open(str_path) players = cPickle.load(file_users) file_users.close() wohdMsg('Skill Database loaded succesfully') spe.registerPreHook("player_hurt", prepHurt) global main, classmenu, info main = popuplib.create('main') main.addline('World of Hell: Diablo Main Menu:') main.addline(':::::::::::::::::::') main.addline('-> 1. Classes') main.addline('-> 2. Skill Tree') main.addline('-> 3. Stats') main.addline('-> 4. Help') main.addline('-> 5. Player Info') main.addline(':::::::::::::::::::') main.addline('-> 8. Reset My Skills') main.addline('0. Exit') main.submenu(1, 'classmenu') main.submenu(4, 'infomenu') main.menuselect = mainSelection infomenu = popuplib.create('infomenu') infomenu.addline('WoH: Diablo Help Menu:') infomenu.addline(':::::::::::::::::::') infomenu.addline('This mod resembles the Diablo 2') infomenu.addline('game. By selecting a class and ') infomenu.addline('choosing skills in your tree, ') infomenu.addline('you gain special abilities. You') infomenu.addline('gain XP with kills and by doing ') infomenu.addline('objectives, making you stronger ') infomenu.addline('and giving you more skills.') infomenu.addline('Type "%s" to reopen the menu.'%wohd_menuCommand) infomenu.addline('bind ""') classmenu = popuplib.create('classmenu') classmenu.addline('WOH: Diablo Class Menu:') classmenu.addline(':::::::::::::::::::') x = 1 for i in classes: classmenu.addline('-> %i. %s'%(x, i)) x+=1 classmenu.addline(':::::::::::::::::::') classmenu.addline('-> 8. Main Menu') classmenu.addline('0. Exit') classmenu.submenu(8, 'main') classmenu.menuselect = classmenuSelection es.unregsaycmd(wohd_menuCommand) es.regsaycmd(wohd_menuCommand, 'wohd/sendMain') es.unregclientcmd(wohd_resetAbilities) es.regclientcmd(wohd_resetAbilities, 'wohd/resetabilities') es.unregclientcmd('ability', 'wohd/ability') es.regclientcmd('ability') es.unregclientcmd('test') es.regclientcmd('test', 'wohd/test') #es.regcmd('cheat', 'wohd/cheat') es.regcmd(wohd_resetEverything, 'wohd/reset') es.regcmd('set', 'wohd/set') def es_map_start(ev): with open(es.getAddonPath('wohd') + "/filelist.txt") as f: for line in f: print es.stringtable("downloadables", "sound/wohd/" + line) def sendMain(): global main main.send(es.getcmduserid()) # Finish this soon def mainSelection(userid, choice, popupid): if choice == 3: sendinfo(userid, userid) if choice == 4: userid = es.getcmduserid() infomenu.send(userid) if choice == 5: playerinfo = '' if popuplib.exists('playerinfo'): popuplib.delete('playerinfo') playerinfo = popuplib.easymenu('playerinfo', '_popup_choice', choosePlayer) for x in es.getUseridList(): playerinfo.addoption(x, es.getplayername(x)) playerinfo.send(userid) if choice == 8: tempmenu = popuplib.create('tempmenu') tempmenu.addline('WoH: Diablo Reset Abilities Menu:') tempmenu.addline('::::::::::::::::::::') tempmenu.addline('CAUTION: DOING THIS WILL DELETE YOUR') tempmenu.addline('SKILLS AND CURRENT XP') tempmenu.addline('YOU WILL NOT BE REFUNDED THIS AMOUNT') tempmenu.addline('ENTER "%s" in console'%resetAbilities) tempmenu.send(userid) popuplib.delete('tempmenu') def choosePlayer(userid, choice, popupid): sendinfo(userid, choice) def sendinfo(userid, target): player = Player(target) Class = player.getItem('Class') level = player.getLevel() xp = player.getExp() str = player.getItem('Strength') dex = player.getItem('Dexterity') vit = player.getItem('Vitality') eng = player.getItem('Energy') mana = player.getItem('Mana') armor = player.getItem('Armor') resistance = player.getItem('Resistance') connected = time.ctime(player.getItem('Last Connected')) statmenu1 = '' if popuplib.exists('stat1menu'): statmenu1 = popuplib.find('stat1menu') else: statmenu1 = popuplib.create('stat1menu') statmenu1.addline('') statmenu1.addline('') statmenu1.addline('') statmenu1.addline('') statmenu1.addline('') statmenu1.addline('') statmenu1.addline('') statmenu1.addline('') statmenu1.modline(1, 'WOH: Diablo Stat Menu:') statmenu1.modline(2, ':::::::::::::::::::') statmenu1.modline(3, '%ss Stats:'%es.getplayername(target)) if not level: statmenu1.modline(4, 'No class selected') else: statmenu1.modline(4, 'Level %s %s %s XP/%s XP'%(level, Class, xp, level * wohd_experiencePerLevel)) statmenu1.modline(5, 'Strength: %s Dexterity: %s Vitality: %s Energy: %s'%(str, dex, vit, eng)) statmenu1.modline(6, 'Mana: %s Armor: %s Resistance: %s'%(mana, armor, resistance)) statmenu1.modline(7, 'Last Connected: %s'%connected) statmenu1.modline(8, '-> 0. Exit') statmenu1.send(userid) popuplib.delete('stat1menu') def classmenuSelection(userid, choice, popupid): if choice < 8: Class = classes[choice - 1] Player(userid).setItem('Pick', choice) tempclasschoice = '' if popuplib.exists(Class): popuplib.delete(Class) tempclasschoice = popuplib.create(Class) tempclasschoice.addline('WoH: Diablo %s'%Class) tempclasschoice.addline(':::::::::::::::::::') if Class == 'Amazon': tempclasschoice.addline('The Amazon is a quick combatant') tempclasschoice.addline('excelling in quick skirmishes or') tempclasschoice.addline('long ranged combat. Gains bonuses') tempclasschoice.addline('with SMGs, pistols, and snipers') if Class == 'Assassin': tempclasschoice.addline('The Assassin is a close-combat') tempclasschoice.addline('expert, utilizing combos to swiftly') tempclasschoice.addline('exterminate enemies with a variety') tempclasschoice.addline('of magical attacks') if Class == 'Barbarian': tempclasschoice.addline('The Barbarian is a brutish wariror') tempclasschoice.addline('that relies on sheer strength and') tempclasschoice.addline('power to annihilate anyone who') tempclasschoice.addline('opposes him.') if Class == 'Druid': tempclasschoice.addline('The Druid harnesses the power of') tempclasschoice.addline('nature to morph into beasts to') tempclasschoice.addline('to tear his enemy to shreds, or') tempclasschoice.addline('or fries them with the elements.') if Class == 'Necromancer': tempclasschoice.addline('The Necromancer curses and devours') tempclasschoice.addline('the souls of others on his search') tempclasschoice.addline('for power over the spirit world.') tempclasschoice.addline('Excells at demorilizing others.') if Class == 'Paladin': tempclasschoice.addline('The Paladin calls upon the holy') tempclasschoice.addline('forces to protect and smite those') tempclasschoice.addline('who seek to corrupt the world.') tempclasschoice.addline('Provides auras and offensive capabilities') if Class == 'Sorceress': tempclasschoice.addline('The Sorceress casts either fire or') tempclasschoice.addline('electrical spells with which to') tempclasschoice.addline('decimate even the biggest adversaries,') tempclasschoice.addline('and applying various detrimental effects.') tempclasschoice.addline(':::::::::::::::::::') tempclasschoice.addline('-> %i. Select %s'%(choice, Class)) tempclasschoice.addline('-> 8. Classes') tempclasschoice.submenu(8, 'classmenu') tempclasschoice.addline('-> 9. Main Menu') tempclasschoice.submenu(9, 'main') tempclasschoice.addline('0. Exit') tempclasschoice.menuselect = classChosen tempclasschoice.send(userid) # Will do when def classChosen(userid, choice, popupid): if choice == Player(userid).getItem('Pick'): Player(userid).setItem('Pick', None) Player(userid).setClass(classes[choice-1]) def test(): global players userid = es.getcmduserid() level = int(es.getargv(1)) xp = int(es.getargv(2)) players[es.getplayersteamid(userid)][Player(userid).getClass()]['Level'] = level players[es.getplayersteamid(userid)][Player(userid).getClass()]['XP'] = xp def getViewPlayer(userid): es.entsetname(userid, 'targetplayer') for index in es.getEntityIndexes('player'): if es.entitygetvalue(index, 'targetname') == 'targetplayer': es.entitysetvalue(index, 'targetname', '') return es.getuserid(es.gethandlefromindex(index)) return None def playsound(userid, sound): es.emitsound("player", userid, "wohd/" + sound, 1, 0) class Player(): def __init__(self, userid, values={}): global players userid = int(userid) if userid not in es.getUseridList(): wohdMsg('Player not found! : %s'%userid) else: self.userid = userid self.steamid = es.getplayersteamid(self.userid) if self.steamid == 'BOT': self.steamid = es.getplayername(userid) self.check() if values: for k,v in values.iteritems(): players[self.steamid][k] = v def check(self): global players if not players.has_key(self.steamid): if not es.isbot(self.userid): changeTeam(self.userid, 1) gamethread.delayed(1.5, wohdTell, (self.userid, 'Welcome to Diablo mod. Select a class to play to get started. Open the menu by typing \'%s\''%wohd_menuCommand)) gamethread.delayed(1.5, main.send, self.userid) wohdMsg('Welcome new player "%s" to Diablo! Please try and assist them with their questions!'%es.getplayername(self.userid)) debug('Setting player to default stats') players[self.steamid] = { 'Class':None, 'Strength':0, 'Dexterity':0, 'Vitality':100, 'Energy':0, 'Mana':0, 'Armor':0, 'Gold':0, 'Resistance':0, 'Skill Points':0, 'Inventory':{}, 'Equipped':{ 'Weapon':None, 'Armor':None, 'Ring 1':None, 'Ring 2':None, 'Amulet':None }, 'Last Connected':time.time(), 'Pick':None, 'Active Ability':0 } for Class in classes: debug('Setting Players Classes To Defaults') players[self.steamid][Class] = { 'Skills':{}, 'Level':1, 'XP':0 } else: if players[self.steamid]['Class'] == None: if not es.getplayersteamid(self.userid) == 'BOT': changeTeam(self.userid, 1) if es.getplayersteamid(self.userid) == 'BOT': self.setClass(random.choice(classes)) spe.respawn(self.userid) def setAbilities(self, Class): global players if Class == 'Amazon': players[self.steamid]['Strength'] = int(12 + self.getLevel() / 2) players[self.steamid]['Dexterity'] = int(15 + self.getLevel() / 1.5) players[self.steamid]['Vitality'] = int(100 + self.getLevel() / 2) players[self.steamid]['Energy'] = int(12 + self.getLevel() / 2) if Class == 'Barbarian': players[self.steamid]['Strength'] = int(15 + self.getLevel() / 1.5) players[self.steamid]['Dexterity'] = int(12 + self.getLevel() / 1.8) players[self.steamid]['Vitality'] = int(115 + self.getLevel() / 1.75) players[self.steamid]['Energy'] = int(10 + self.getLevel() / 2.5) if Class == 'Druid': players[self.steamid]['Strength'] = int(15 + self.getLevel() / 2.25) players[self.steamid]['Dexterity'] = int(10 + self.getLevel() / 1.75) players[self.steamid]['Vitality'] = int(100 + self.getLevel() / 2) players[self.steamid]['Energy'] = int(15 + self.getLevel() / 2.25) if Class == 'Paladin': players[self.steamid]['Strength'] = int(13 + self.getLevel() / 2) players[self.steamid]['Dexterity'] = int(13 + self.getLevel() / 2) players[self.steamid]['Vitality'] = int(115 + self.getLevel() / 1.75) players[self.steamid]['Energy'] = int(13 + self.getLevel() / 2) if Class == 'Sorceror': players[self.steamid]['Strength'] = int(10 + self.getLevel() / 2.5) players[self.steamid]['Dexterity'] = int(12 + self.getLevel() / 2) players[self.steamid]['Vitality'] = int(100 + self.getLevel() / 2.25) players[self.steamid]['Energy'] = int(20 + self.getLevel() / 1.5) if Class == 'Witch Doctor': players[self.steamid]['Strength'] = int(10 + self.getLevel() / 2.5) players[self.steamid]['Dexterity'] = int(14 + self.getLevel() / 2) players[self.steamid]['Vitality'] = int(100 + self.getLevel() / 2.25) players[self.steamid]['Energy'] = int(18 + self.getLevel() / 1.5) def setClass(self, Class): global players if round_started: if not es.getplayerprop(self.userid, 'CBasePlayer.pl.deadflag'): wohdTell(self.userid, 'You will be a %s next round'%Class) self.setItem('Pick', Class) return 0 players[self.steamid]['Class'] = Class debug(players[self.steamid][Class]['Level']) wohdTell(self.userid, 'You are now a %s'%Class) self.setAbilities(Class) def getClass(self): return players[self.steamid]['Class'] def getLevel(self, Class=None): global players if Class == None: if not self.getItem('Class'): return None return players[self.steamid][self.getItem('Class')]['Level'] else: return players[self.steamid][Class]['Level'] def giveExp(self, amount, reason=None): global players if self.getLevel() < wohd_levelCap: players[self.steamid][self.getItem('Class')]['XP'] += amount if reason: wohdTell(self.userid, 'You have gained #default%s XP#green for %s'%(amount, reason)) if self.getExp() >= self.getLevel() * wohd_experiencePerLevel: self.giveLevel() def getExp(self, Class=None): global players if Class == None: if not self.getItem('Class'): return 0 return players[self.steamid][self.getItem('Class')]['XP'] else: return players[self.steamid][Class]['XP'] def giveLevel(self): global players if self.getLevel() < wohd_levelCap: if self.getExp() >= self.getLevel() * wohd_experiencePerLevel: playsound(self.userid, "levelup.wav") players[self.steamid][self.getClass()]['XP'] -= players[self.steamid][self.getClass()]['Level'] * wohd_experiencePerLevel players[self.steamid][self.getClass()]['Level'] += 1 wohdMsg('Congratulations to %s for hitting level %s!'%(es.getplayername(self.userid), self.getLevel())) def getItem(self, stat): if players[self.steamid].has_key(stat): return players[self.steamid][stat] return 0 def setItem(self, item, value): players[self.steamid][item] = value def set_round_started(x=1): global round_started round_started = x def round_start(ev): gamethread.delayed(es.ServerVar('mp_freezetime'), set_round_started) gamethread.cancelDelayed('wohdloops') def item_pickup(ev): if ev['item'] in ['vesthelm', 'item_assaultsuit', 'assaultsuit']: Player(ev['userid']).setItem(Player(ev['userid'].getItem('Armor') + 100)) def player_team(ev): if int(ev['team']) > 1: player = Player(ev['userid']) def preSpawn(ev): player = Player(ev['userid']) if player.getItem('Pick'): player.setItem('Class', player.getItem('Pick')) wohdTell(ev['userid'], 'You are now a %s'%player.getClass()) def player_spawn(ev): player = Player(ev['userid']) es.setplayerprop(ev['userid'], 'CBasePlayer.m_iHealth', player.getItem('Vitality')) player.setItem('Mana', player.getItem('Energy') * 2) player.setItem('Armor', 0) def player_activate(ev): Player(ev['userid'], {'Last Connected':time.time()}) def prepHurt(ev): userid = ev['userid'] attacker = ev['attacker'] if attacker in es.getUseridList() and userid in es.getUseridList(): victim = Player(userid) attacker = Player(attacker) damage = ev['dmg_health'] health = es.getplayerprop(victim.userid, 'CBasePlayer.m_iHealth') dodge = victim.getItem('Dodge') + victim.getItem('Dexterity') * .1 if random.randint(1,100) < dodge: es.setplayerprop(victim.userid, 'CBasePlayer.m_iHealth', int(es.getplayerprop(victim.userid, 'CBasePlayer.m_iHealth')) + damage) wohdTell(victim.userid, 'You have successfully evaded an attack!') pass if health > 0: crit = random.choice([0,1]) damageReduction = int(victim.getItem('Damage Reduction') + victim.getItem('Armor') / 100) extraDamage = victim.getItem('Damage') if crit: damage = damage - int(damage * damageReduction / 100) + damage - int(damage * damageReduction / 100) else: damage = damage - int(damage * damageReduction / 100) if damage + int(damage * extraDamage / 100) >= health: Damage(victim.userid, attacker.userid, int(damage * (extraDamage / 100))) def Damage(userid, attacker, damage, type='physical'): if type == 'physical': if es.getplayerprop(userid, 'CBasePlayer.m_iHealth') <= damage: es.server.queuecmd('damage %s %s 32 %s'%(userid, damage, attacker)) else: es.setplayerprop(userid, 'CBasePlayer.m_iHealth', int(es.getplayerprop(userid, 'CBasePlayer.m_iHealth'))-damage) if type == 'magical': # There is a % chance of mitigating all magic damage equal to their resistance + .1% for every level higher they are # compared to their victim. The same is also true for reducing magic damage dealt. difference = Player(attacker).getLevel() - Player(userid).getLevel() if random.randint(1,100) < Player(userid).getItem('Resistance') + difference / 10: pass else: damage = damage - ((Player(userid).getItem('Resistance') + difference / 10) / 100 * damage) if es.getplayerprop(userid, 'CBasePlayer.m_iHealth') <= damage: es.server.queuecmd('damage %s %s 32 %s'%(userid, damage, attacker)) else: es.setplayerprop(userid, 'CBasePlayer.m_iHealth', int(es.getplayerprop(userid, 'CBasePlayer.m_iHealth'))-damage) def player_death(ev): if ev['es_attackerteam'] != ev['es_userteam']: Player(ev['attacker']).giveExp(int(wohd_killExp), 'killing an enemy') ''' def player_jump(ev): userid = ev['userid'] if int(int(players[playerlib.uniqueid(userid)]['Jump'])): level = int(int(players[playerlib.uniqueid(userid)]['Jump'])) deBug(level) myVec = [es.getplayerprop(userid, 'CBasePlayer.localdata.m_vecVelocity[%s]' % x) * 1 for x in range(3)] if level == 1: myVec[0] = 0 myVec[1] = 0 myVec[2] *= .4 if level == 2: myVec[0] = .1 myVec[1] = .1 myVec[2] *= .4 if level == 3: myVec[0] = .2 myVec[1] = .2 myVec[2] *= .6 if level == 4: myVec[0] = .4 myVec[1] = .4 myVec[2] *= .7 if level > 0: deBug('Jump code') es.setplayerprop(userid, 'CBasePlayer.localdata.m_vecBaseVelocity', '%s,%s,%s' % tuple(myVec)) ''' def resetabilities(): global players userid = es.getcmduserid() players[ev['userid']]['class']['Level'] = 1 players[ev['userid']]['class']['XP'] = 0 players[ev['userid']]['class']['Skills'] = {} players[ev['userid']]['class']['Skill Points'] = 0 wohdTell(userid, ['Your abilities have been reset']) def reset(): global players players = {} str_path = open(es.getAddonPath('wohd') + '/wohd.db', 'w') cPickle.dump(players, str_path) str_path.close() wohdMsg("Everyone's Abilities have been reset to start a new...") gamethread.delayed(3, es.reload, ('wohd')) es.server.queuecmd('mp_restartgame 3') def unload(): str_path = open(es.getAddonPath('wohd') + '/wohd.db', 'w') cPickle.dump(players, str_path) str_path.close() spe.unregisterPreHook("player_hurt", prepHurt) def round_end(ev): set_round_started(0) gamethread.cancelDelayed('wohdloops') str_path = open(es.getAddonPath('wohd') + '/wohd.db', 'w') cPickle.dump(players, str_path) str_path.close() winner = int(ev['winner']) for userid in es.getUseridList(): if winner > 1: if es.getplayerteam(userid) == winner: Player(userid).giveExp(wohd_roundExp, 'winning the round') def bomb_planted(ev): Player(ev['userid']).giveExp(wohd_bomb_plantedExp, 'planting the bomb') def bomb_exploded(ev): Player(ev['userid']).giveExp(wohd_bomb_explodedExp, 'the bomb exploding') def bomb_defused(ev): Player(ev['userid']).giveExp(wohd_bomb_defusedExp, 'defusing the bomb') def hostage_rescued(ev): Player(ev['userid']).giveExp(wohd_rescueExp, 'rescuing a hostage') def hostage_rescued_all(ev): Player(ev['userid']).giveExp(wohd_allExp, 'rescuing all hostages') def ability(): userid = Player(es.getcmduserid()) skill = es.getargv(1)