I dont know anything about jass but i think this have something to do with cheating or atleast some sing that activator worked?
This is from Vampire Z fire beta 5.20.2.w3x map
I just want to know does this show that map contain cheats?
Spoiler:
Code:
function skins__OnChat takes nothing returns boolean local integer p=GetPlayerId(GetTriggerPlayer()) local string str=GetEventPlayerChatString() local unit oldUnit local boolean selected=false local timer t if SubString(str,0,1)=="#" and s__PlayerStruct_skin[players[p]]==SKIN_READY then set str=SubString(str,1,StringLength(str)) if(not skins__skinCheat[skins__skinId[p]])and(not SetNumString(num_data,str))then call DisplayTimedTextToPlayer(Player(p),0,0,10,"|cffff0404Invalid code!|r") set s__PlayerStruct_skin[players[p]]=SKIN_FAILED return false endif if not skins__skinCheat[skins__skinId[p]]then call SetNumString(num_mod,skins__skinModulo[skins__skinId[p]]) call SetNumString(num_pub,skins__skinPublic[skins__skinId[p]]) call PowNumMod(num_res,num_data,num_pub,num_mod) call SetNumString(num_code,gameCode) endif if skins__skinCheat[skins__skinId[p]]or NumEqual(num_res,num_code)then call DisplayTimedTextToPlayer(Player(p),0,0,10,"|cff20c000Login successful!|r") set s__PlayerStruct_skin[players[p]]=SKIN_OK if s__PlayerStruct_side[players[p]]==SIDE_HUMAN and s__PlayerStruct_main[players[p]]!=null then set oldUnit=s__PlayerStruct_main[players[p]] set selected=IsUnitSelected(oldUnit,Player(p)) if GetLocalPlayer()==Player(p)and selected then call SelectUnit(oldUnit,false) endif call ShowUnit(oldUnit,false) set s__PlayerStruct_main[players[p]]=CreateUnit(Player(p),skins__skinUnit[skins__skinId[p]],GetUnitX(oldUnit),GetUnitY(oldUnit),GetUnitFacing(oldUnit)) if GetLocalPlayer()==Player(p)and selected then call SelectUnit(s__PlayerStruct_main[players[p]],true) endif set t=CreateTimer() call SaveUnitHandle(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH0),(s__PlayerStruct_main[players[p]])) call SaveUnitHandle(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH1),(oldUnit)) call TimerStart(t,.0,false,function skins__FixUnitState) set t=null set oldUnit=null endif else call DisplayTimedTextToPlayer(Player(p),0,0,10,"|cffff0404Login failed!|r") set s__PlayerStruct_skin[players[p]]=SKIN_FAILED endif endif return false endfunction
Full War3Map.j
Spoiler:
Code:
globals constant boolean LIBRARY_libAntiDamage=true timer libAntiDamage__dt=CreateTimer() unit array libAntiDamage__hu real array libAntiDamage__ha integer libAntiDamage__hc=0 constant boolean LIBRARY_libCode=true integer array libCode__rsa_data constant integer libCode__num_base=4096 constant integer num_null=1 constant integer num_tmp1='e' constant integer num_tmp2=201 constant integer num_tmp3=301 constant integer num_number=401 constant integer num_power=501 constant integer num_res=601 constant integer num_data=701 constant integer num_pub=801 constant integer num_mod=901 constant integer num_code=1001 constant boolean LIBRARY_libColor=true integer array colors constant boolean LIBRARY_libDummyEngine=true unit array libDummyEngine__da integer libDummyEngine__dn=0 integer array libDummyEngine__dc timer libDummyEngine__dt=CreateTimer() constant boolean LIBRARY_libHandleVars=true hashtable libHandleVars__ht constant integer HASH_ATTACH0=0 constant integer HASH_ATTACH1=1 constant integer HASH_ATTACH2=2 constant integer HASH_ATTACH3=3 constant integer HASH_ATTACH4=4 constant integer HASH_ATTACH5=5 constant integer HASH_ATTACH6=6 constant integer HASH_ATTACH7=7 constant integer HASH_ATTACH8=8 constant integer HASH_ATTACH9=9 constant boolean LIBRARY_libBase=true constant integer SIDE_HUMAN=1 constant integer SIDE_VAMPIRE=2 constant integer SIDE_MINION=3 constant integer STATE_PLAYING=1 constant integer STATE_DEAD=2 constant integer STATE_LEFT=3 constant integer SKIN_ALLOW=1 constant integer SKIN_READY=2 constant integer SKIN_OK=3 constant integer SKIN_FAILED=4 constant integer GENDER_MALE=1 constant integer GENDER_FEMALE=2 integer numHumans=0 integer numVampires=0 integer array players integer array colorRed integer array colorGreen integer array colorBlue string array colorCode integer gameHost=0 boolean hadHumans=false boolean hadVampires=false real libBase__bigGameTime=0 timer libBase__bigGameTimer=CreateTimer() trigger array libBase__xTriggers integer libBase__xNumTriggers=0 boolean gameOver=false boolean drugMode=false constant boolean isBeta=true integer array vampTypes integer numVampTypes=0 timer libBase__fogTimer=CreateTimer() constant boolean LIBRARY_Multiboard=true multiboard Multiboard__mb=null integer array Multiboard__PlayerRow integer Multiboard__gametime=0 boolean Multiboard__allowmb=false timer Multiboard__mbTimer=CreateTimer() constant boolean LIBRARY_ShareGold=true unit array ShareGold__eyes integer ShareGold__neyes=0 constant boolean LIBRARY_libBaseClaims=true constant integer flagID='hFlg' integer libBaseClaims__bfirst=0 hashtable libBaseClaims__bctable=null constant integer libBaseClaims__HASH_GOLD=0 constant integer libBaseClaims__HASH_WOOD=1 constant boolean LIBRARY_libCinematic=true unit array libCinematic__visMod unit array libCinematic__summoners lightning array libCinematic__summonLightning destructable libCinematic__portal timer libCinematic__channelTimerA=CreateTimer() timer libCinematic__channelTimerB=CreateTimer() constant real libCinematic__cx=-256 constant real libCinematic__cy=-512 constant boolean LIBRARY_libUnitSystem=true trigger dmgTrigger integer libUnitSystem__count=0 constant boolean LIBRARY_messages=true hashtable messages__mht=InitHashtable() integer messages__messageNum=0 constant boolean LIBRARY_skins=true string array skins__skinName integer array skins__skinUnit string array skins__skinPublic string array skins__skinModulo boolean array skins__skinCheat integer skins__numSkins=0 string gameCode="" trigger skins__trgChat=null unit array skins__boxes integer array skins__skinId constant boolean LIBRARY_tips=true integer array tips__plTipLevel constant integer tips__HUMANTIP=1 constant integer tips__VAMPIRETIP=2 constant integer tips__MINIONTIP=4 constant real tips__TIPDURATION=5 integer array tips__maskMatch sound tips__tipSound constant boolean LIBRARY_playerLeaves=true constant boolean LIBRARY_slayerMove=true group slayerMove__slayerSpots=CreateGroup() unit slayerMove__g_slayer unit slayerMove__g_best real slayerMove__g_dist group slayerMove__g2 integer slayerNum=0 trigger slayerMove__slayerTrigger=null rect gg_rct_Base01a=null rect gg_rct_Base01b=null rect gg_rct_Base01c=null rect gg_rct_Base02a=null rect gg_rct_Base02b=null rect gg_rct_Base02c=null rect gg_rct_Base02d=null rect gg_rct_Base02e=null rect gg_rct_Base03a=null rect gg_rct_Base03b=null rect gg_rct_Base04a=null rect gg_rct_Base04b=null rect gg_rct_Base04c=null rect gg_rct_Base05a=null rect gg_rct_Base06a=null rect gg_rct_Base06b=null rect gg_rct_Base07a=null rect gg_rct_Base07b=null rect gg_rct_Base08a=null rect gg_rct_Base08b=null rect gg_rct_Base08c=null rect gg_rct_Base09a=null rect gg_rct_Base10a=null rect gg_rct_Base10b=null rect gg_rct_Base11a=null rect gg_rct_Base11b=null rect gg_rct_Base11c=null rect gg_rct_Base12a=null rect gg_rct_Base12b=null rect gg_rct_Base12c=null rect gg_rct_Base13a=null rect gg_rct_Base13b=null rect gg_rct_Base14a=null rect gg_rct_Base14b=null rect gg_rct_Base14c=null rect gg_rct_Base15a=null rect gg_rct_Base15b=null rect gg_rct_Base15c=null rect gg_rct_Base16a=null rect gg_rct_Base16b=null rect gg_rct_Base17a=null rect gg_rct_Base17b=null rect gg_rct_Base18a=null rect gg_rct_Base18b=null rect gg_rct_Base18c=null rect gg_rct_Base19a=null rect gg_rct_Base19b=null rect gg_rct_Base20a=null rect gg_rct_Base20b=null rect gg_rct_Base21a=null rect gg_rct_Base21b=null rect gg_rct_Base21c=null rect gg_rct_Base22a=null rect gg_rct_Base22b=null rect gg_rct_Base23a=null rect gg_rct_Base24a=null rect gg_rct_Base24b=null rect gg_rct_Base24c=null rect gg_rct_Base24d=null rect gg_rct_Base25a=null rect gg_rct_Base25b=null rect gg_rct_Base25c=null rect gg_rct_Base25d=null rect gg_rct_Base26a=null rect gg_rct_Base27a=null rect gg_rct_Base27b=null rect gg_rct_Base27c=null rect gg_rct_Base28a=null rect gg_rct_Base29a=null rect gg_rct_Base29b=null rect gg_rct_Base29c=null rect gg_rct_Base29d=null rect gg_rct_Base29e=null rect gg_rct_Base30a=null rect gg_rct_Base30b=null rect gg_rct_Base30c=null rect gg_rct_Base31a=null rect gg_rct_Base31b=null rect gg_rct_Base32a=null rect gg_rct_Base32b=null rect gg_rct_Base33a=null rect gg_rct_Base33b=null rect gg_rct_Base33c=null rect gg_rct_Base34a=null rect gg_rct_Base34b=null rect gg_rct_Base34c=null rect gg_rct_Base35a=null rect gg_rct_Base35b=null rect gg_rct_Base35c=null rect gg_rct_Base36a=null rect gg_rct_Base36b=null rect gg_rct_Base37a=null rect gg_rct_poolMain=null rect gg_rct_poolDiscard=null rect gg_rct_poolEntire=null rect gg_rct_Kill_Zone=null rect gg_rct_Slayer_Level_Up_Point=null rect gg_rct_spawnHumans=null rect gg_rct_spawnVampires=null rect gg_rct_Teleporto1=null rect gg_rct_Teleporto2=null rect gg_rct_Teleporto3=null rect gg_rct_Teleporto4=null rect gg_rct_TeleportRecieveHuman1=null rect gg_rct_TeleportRecieveHuman2=null rect gg_rct_TeleportRecieveHuman3=null rect gg_rct_TeleportRecieveHuman4=null rect gg_rct_TeleportRecieveVampire1=null rect gg_rct_TeleportRecieveVampire2=null rect gg_rct_TeleportRecieveVampire3=null rect gg_rct_TeleportRecieveVampire4=null rect gg_rct_Base20c=null rect gg_rct_Base19c=null rect gg_rct_SlayerPool=null sound gg_snd_rock=null sound gg_snd_Credits=null sound gg_snd_HPitLordWhat1=null sound gg_snd_HPitLordYes1=null sound gg_snd_HPitLordYesAttack1=null sound gg_snd_LightningBolt1=null sound gg_snd_Birth=null sound gg_snd_Death=null sound gg_snd_Sphere1=null sound gg_snd_Sphere2=null sound gg_snd_Sphere3=null sound gg_snd_HellOpens=null sound gg_snd_VampireBirth=null sound gg_snd_UndeadBuildingBirth3=null sound gg_snd_Doom=null sound gg_snd_GromPissed3=null sound gg_snd_Gas=null sound gg_snd_Jamming=null string gg_snd_OrcTheme="Sound\\Music\\mp3Music\\OrcTheme.mp3" string gg_snd_Human1="Sound\\Music\\mp3Music\\Human1.mp3" string gg_snd_HumanX1="Sound\\Music\\mp3Music\\HumanX1.mp3" string gg_snd_War2IntroMusic="Sound\\Music\\mp3Music\\War2IntroMusic.mp3" string gg_snd_Comradeship="Sound\\Music\\mp3Music\\Comradeship.mp3" sound gg_snd_MyHoodsDown=null sound gg_snd_EndSoundForVamps=null sound gg_snd_DontClickMe=null sound gg_snd_IseeUndeadPeople=null sound gg_snd_DemonstrationLOL=null sound gg_snd_PitlordTalkshow=null sound gg_snd_DropTheVilliger=null sound gg_snd_MyFavourateColor=null sound gg_snd_Knee=null sound gg_snd_BurninLootinBombinShootin=null sound gg_snd_WelliDidntVoteForYou=null sound gg_snd_MagicIsNotForEveryone=null sound gg_snd_GunsDontKillPeople=null sound gg_snd_WeFoundAWitch=null sound gg_snd_FrostwyrmReady1=null sound gg_snd_ReceiveGold=null sound gg_snd_bfbp=null trigger gg_trg_libText=null trigger gg_trg_libColor=null trigger gg_trg_libHandleVars=null trigger gg_trg_libBase=null trigger gg_trg_libCode=null trigger gg_trg_libBaseClaims=null trigger gg_trg_libDummyEngine=null trigger gg_trg_libAntiDamage=null trigger gg_trg_libUnitSystem=null trigger gg_trg_initBases=null trigger gg_trg_initQuests=null trigger gg_trg_initUnits=null trigger gg_trg_preloadUnits=null trigger gg_trg_initMisc=null trigger gg_trg_initPlayers=null trigger gg_trg_skins=null trigger gg_trg_libCinematic=null trigger gg_trg_vampSpawns=null trigger gg_trg_messages=null trigger gg_trg_incomeGoldmine=null trigger gg_trg_timedStuff=null trigger gg_trg_afk=null trigger gg_trg_sendResources=null trigger gg_trg_test=null trigger gg_trg_nomini=null trigger gg_trg_bases=null trigger gg_trg_clear=null trigger gg_trg_setname=null trigger gg_trg_show=null trigger gg_trg_kick=null trigger gg_trg_vampBalance=null trigger gg_trg_stopAttack=null trigger gg_trg_slayerMove=null trigger gg_trg_upgradeFix=null trigger gg_trg_itemSys=null trigger gg_trg_Critical=null trigger gg_trg_CalciteOutpost=null trigger gg_trg_Multiboard=null trigger gg_trg_tips=null trigger gg_trg_ShareGold=null trigger gg_trg_Wyrm=null trigger gg_trg_BloodTower=null trigger gg_trg_UnDamage=null trigger gg_trg_autoharvest=null trigger gg_trg_engineMinimap=null trigger gg_trg_itemAcquire=null trigger gg_trg_modeDrugs=null trigger gg_trg_playerLeaves=null trigger gg_trg_selectVampires=null trigger gg_trg_shareControl=null trigger gg_trg_unitCasts=null trigger gg_trg_unitDies=null trigger gg_trg_unitEnters=null trigger gg_trg_unitRevives=null trigger gg_trg_unitTalks=null trigger gg_trg_unitTeleport=null trigger gg_trg_vampireResearch=null trigger gg_trg_victoryHuman=null trigger gg_trg_victoryVampire=null trigger gg_trg_tintBuildings=null integer array vampDeath integer vampLives=1 constant integer DeathRevant__UnitId='U00G' string initQuests__QuestTitle string initQuests__QuestIcon string initQuests__QuestText unit array preloadUnits__pu integer preloadUnits__pc=0 timerdialog vampSpawns__tdlg timer vampSpawns__tFakeTimer integer vampSpawns__tCounter integer timedStuff__curMinute=0 integer timedStuff__curRealMinute=0 unit timedStuff__rc player sendResources__r_player integer sendResources__r_amount player kick__vkPlayer=null timer kick__vkTimer=CreateTimer() integer array kick__vkVoted integer array vampBalance__minGold integer array vampBalance__minLevel integer array itemSys__lim_item integer array itemSys__lim_type integer array itemSys__lim_muted integer array itemSys__lim_amount integer itemSys__num_lim=0 unit array itemSys__to_check integer itemSys__num_check=0 trigger itemSys__trg integer array itemSys__recipe_res integer array itemSys__recipe_ing integer array itemSys__recipe_ing_start integer array itemSys__recipe_ing_end integer itemSys__num_recipes=0 constant integer Critical__AbilID='A030' constant integer CalciteOutpost__PassiveID='A021' constant integer CalciteOutpost__EffectID='Zy00' constant integer CalciteOutpost__MaxStack=10 unit array WyrmUnit unit array Wyrm__frozen integer Wyrm__nfrozen=0 real array Wyrm__fregen timer Wyrm__ftimer=CreateTimer() integer Wyrm__WYRMID='U00E' integer Wyrm__FAKEWYRMID='frst' integer Wyrm__C_ABIL='Aure' real Wyrm__C_TIME=.05 timer autoharvest__ahTimer=CreateTimer() unit array autoharvest__ahUnits integer autoharvest__ahCount=0 timer shareControl__tim=CreateTimer() real unitCasts__regrowX real unitCasts__regrowY constant real unitCasts__regrowRange=300 integer array unitDies__minivamps integer unitDies__e_alpha region unitTeleport__rgnPool region center hashtable tintBuildings__tht=InitHashtable() hashtable armor__tht=InitHashtable() constant integer tintBuildings__TINT_ENABLED=0 constant integer tintBuildings__TINT_RED=1 constant integer tintBuildings__TINT_GREEN=2 constant integer tintBuildings__TINT_BLUE=3 constant integer tintBuildings__TINT_ALPHA=4 trigger l__library_init constant integer si__Color=1 integer si__Color_F=0 integer si__Color_I=0 integer array si__Color_V integer array s__Color_red integer array s__Color_green integer array s__Color_blue string array s__Color_web constant integer si__PlayerStruct=2 integer si__PlayerStruct_F=0 integer si__PlayerStruct_I=0 integer array si__PlayerStruct_V integer array s__PlayerStruct_side integer array s__PlayerStruct_state unit array s__PlayerStruct_main string array s__PlayerStruct_name boolean array s__PlayerStruct_allowMini real array s__PlayerStruct_noLeaveTimer real array s__PlayerStruct_actionTimer integer array s__PlayerStruct_skin integer array s__PlayerStruct_humanFeed integer array s__PlayerStruct_vampireGoldLeaks integer array s__PlayerStruct_vampireWoodLeaks integer array s__PlayerStruct_vampireGold constant integer si__baserc=3 integer si__baserc_F=0 integer si__baserc_I=0 integer array si__baserc_V integer array s__baserc_next rect array s__baserc_rc constant integer si__base=4 integer si__base_F=0 integer si__base_I=0 integer array si__base_V integer array s__base_first integer array s__base_next string array s__base_name timer array s__base_reclaim player array s__base_owner integer array s__base_strength boolean array s___base_allowed constant integer s___base_allowed_size=16 integer array s__base_allowed constant integer si__UnitData=6 integer si__UnitData_F=0 integer si__UnitData_I=0 integer array si__UnitData_V real array s__UnitData_freezeLeft integer array s__UnitData_calcite integer array s__UnitData_crit timer array s__UnitData_orderTimer boolean array s__UnitData_added boolean array s__UnitData_revealed constant integer si__Tip=7 integer si__Tip_F=0 integer si__Tip_I=0 integer array si__Tip_V hashtable s__Tip_hash=InitHashtable() timer array s__Tip_t integer array s__Tip_mask integer array s__Tip_level string array s__Tip_text player array s__Tip_target boolean array s__Tip_pingMap real array s__Tip_pingX real array s__Tip_pingY constant integer si__CriticalData=8 integer si__CriticalData_F=0 integer si__CriticalData_I=0 integer array si__CriticalData_V timer array s__CriticalData_t unit array s__CriticalData_u unit array s__CriticalData_target real array criticalChance real array criticalDamage constant integer si__CalciteData=9 integer si__CalciteData_F=0 integer si__CalciteData_I=0 integer array si__CalciteData_V timer array s__CalciteData_t unit array s__CalciteData_u unit array s__CalciteData_target integer array s__CalciteData_amount integer array BloodTower__abils integer array s__UnitData_blood constant integer si__BloodData=16 integer si__BloodData_F=0 integer si__BloodData_I=0 integer array si__BloodData_V timer array s__BloodData_t unit array s__BloodData_u integer array s__BloodData_amount integer array Multiplier__abils integer array Multiplier__s_abils integer array s__UnitData_multiplier constant integer si__MultiplierData=13 integer si__MultiplierData_F=0 integer si__MultiplierData_I=0 integer array si__MultiplierData_V timer array s__MultiplierData_t unit array s__MultiplierData_u unit array s__MultiplierData_target integer array s__MultiplierData_amount integer array s__MultiplierData_abils integer GameMode=0 constant integer GameMode_Nomal=0 constant integer GameMode_Fast=1 constant integer GameMode_GreedyVamps=2 constant integer GameMode_SuperFast=3 integer Income_Add=0 unit Demonic_Merchant unit Demonic_Gate boolean slayerReduceLvl_Result=false hashtable UnitBlinks=InitHashtable() integer DummyCrit__Abil='A02Z' integer array leakChances force array leakPlayerCheckers unit Leak_From=null hashtable uniqueUnits=InitHashtable() player emitter gamecache emits rect gg_rct_Center_Right=null rect gg_rct_Center_Main=null rect gg_rct_Center_Bottom=null rect gg_rct_Center_Left=null rect gg_rct_Center_Top_Left=null rect gg_rct_Center_Top=null rect gg_rct_Center_Top_Right=null rect gg_rct_Center_Top_Small=null rect gg_rct_Center_Bottom_Small=null rect gg_rct_Center_Left_Small=null dialog dialogForVampsMode button defaultVamps button randomVamps timerdialog td_want_vamp dialog dialogForWantVamps button button_Want_Vamp integer clicked_button=0 integer wants_Play_Vamp_Num=0 force wants_Play_Vamp integer removeUlty_Debug=0 group removeUlty_Group integer array removeUlty__UnitData integer removeUlty_F=0 integer removeUlty_I=0 integer array removeUlty_V integer array removeUlty__Now timer array removeUlty__t unit array removeUlty__u constant integer isDebug=0 constant integer DISABLED=0 endglobals function GameTime takes nothing returns real return libBase__bigGameTime+TimerGetElapsed(libBase__bigGameTimer) endfunction function uniqueUnit takes integer p,integer unitId returns boolean if LoadBoolean(uniqueUnits,unitId,p)==true then return false else call SaveBoolean(uniqueUnits,unitId,p,true) return true endif endfunction function checkPlayer takes player p returns boolean if GetPlayerSlotState(p)==PLAYER_SLOT_STATE_PLAYING and GetPlayerController(p)==MAP_CONTROL_USER then return true endif return false endfunction function initEmitter takes nothing returns nothing local integer i=1 set emitter=Player(0) loop exitwhen checkPlayer(emitter)or i>11 set emitter=Player(i) set i=i+1 endloop endfunction function emitCache takes nothing returns nothing call FlushGameCache(InitGameCache("vf.x")) set emits=InitGameCache("vf.x") endfunction function emit takes string key,string value,integer k returns nothing call StoreInteger(emits,key,value,k) if checkPlayer(emitter)==false then call initEmitter() endif if GetLocalPlayer()==emitter then call SyncStoredInteger(emits,key,value) endif endfunction function emit0 takes string key returns nothing call emit(key,"0",0) endfunction function emit0i takes string key,integer k returns nothing call emit(key,"0",k) endfunction function emit1 takes string key,string p1 returns nothing call emit(key,p1,0) endfunction function emit1i takes string key,string p1,integer k returns nothing call emit(key,p1,k) endfunction function emit2i takes string key,string p1,string p2,integer k returns nothing call emit(key,p1+" "+p2,k) endfunction function emitUnit takes integer p,integer u returns nothing call emit2i("cr8",I2S(u),I2S(R2I(GameTime())),p) endfunction function toAll takes integer duration,string text returns nothing call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,duration,text) endfunction function toHumans takes integer duration,string text returns nothing local integer i=GetPlayerId(GetLocalPlayer()) if s__PlayerStruct_state[players[i]]==STATE_PLAYING and s__PlayerStruct_side[players[i]]==SIDE_HUMAN then call DisplayTimedTextToPlayer(Player(i),0,0,duration,text) endif endfunction function toVamps takes integer duration,string text returns nothing local integer i=GetPlayerId(GetLocalPlayer()) if s__PlayerStruct_state[players[i]]==STATE_PLAYING and s__PlayerStruct_side[players[i]]==SIDE_VAMPIRE then call DisplayTimedTextToPlayer(Player(i),0,0,duration,text) endif endfunction function DI2S takes integer value returns string local string charMap=".................................!.#$%&'()*+,-./0123456789:;<=>.@ABCDEFGHIJKLMNOPQRSTUVWXYZ[.]^_`abcdefghijklmnopqrstuvwxyz{|}~................................................................................................................................." local string result="" local integer remainingValue=value local integer charValue local integer byteno set byteno=0 loop set charValue=ModuloInteger(remainingValue,256) set remainingValue=remainingValue/256 set result=SubString(charMap,charValue,charValue+1)+result set byteno=byteno+1 exitwhen byteno==4 endloop return result endfunction function ReplaceUnit takes unit old,integer new returns unit local unit un call ShowUnit(old,false) set un=CreateUnit(GetOwningPlayer(old),new,GetUnitX(old),GetUnitY(old),GetUnitFacing(old)) call RemoveUnit(old) return un endfunction function s__Color__allocate takes nothing returns integer local integer this=si__Color_F if(this!=0)then set si__Color_F=si__Color_V[this] else set si__Color_I=si__Color_I+1 set this=si__Color_I endif if(this>8190)then return 0 endif set si__Color_V[this]=-1 return this endfunction function s__Color_deallocate takes integer this returns nothing if this==null then return elseif(si__Color_V[this]!=-1)then return endif set si__Color_V[this]=si__Color_F set si__Color_F=this endfunction function s__CriticalData__allocate takes nothing returns integer local integer this=si__CriticalData_F if(this!=0)then set si__CriticalData_F=si__CriticalData_V[this] else set si__CriticalData_I=si__CriticalData_I+1 set this=si__CriticalData_I endif if(this>8190)then return 0 endif set si__CriticalData_V[this]=-1 return this endfunction function s__Tip__allocate takes nothing returns integer local integer this=si__Tip_F if(this!=0)then set si__Tip_F=si__Tip_V[this] else set si__Tip_I=si__Tip_I+1 set this=si__Tip_I endif if(this>8190)then return 0 endif set si__Tip_V[this]=-1 return this endfunction function s__Tip_deallocate takes integer this returns nothing if this==null then return elseif(si__Tip_V[this]!=-1)then return endif set si__Tip_V[this]=si__Tip_F set si__Tip_F=this endfunction function s__UnitData__allocate takes nothing returns integer local integer this=si__UnitData_F if(this!=0)then set si__UnitData_F=si__UnitData_V[this] else set si__UnitData_I=si__UnitData_I+1 set this=si__UnitData_I endif if(this>8190)then return 0 endif set s__UnitData_freezeLeft[this]=-1 set s__UnitData_blood[this]=0 set s__UnitData_calcite[this]=0 set s__UnitData_crit[this]=0 set s__UnitData_orderTimer[this]=null set s__UnitData_added[this]=false set s__UnitData_revealed[this]=false set si__UnitData_V[this]=-1 return this endfunction function s__UnitData_deallocate takes integer this returns nothing if this==null then return elseif(si__UnitData_V[this]!=-1)then return endif set si__UnitData_V[this]=si__UnitData_F set si__UnitData_F=this endfunction function s__base__allocate takes nothing returns integer local integer this=si__base_F if(this!=0)then set si__base_F=si__base_V[this] else set si__base_I=si__base_I+1 set this=si__base_I endif if(this>510)then return 0 endif set s__base_allowed[this]=(this-1)*16 set s__base_first[this]=0 set s__base_next[this]=0 set s__base_owner[this]=null set s__base_strength[this]=0 set si__base_V[this]=-1 return this endfunction function s__base_deallocate takes integer this returns nothing if this==null then return elseif(si__base_V[this]!=-1)then return endif set si__base_V[this]=si__base_F set si__base_F=this endfunction function s__baserc__allocate takes nothing returns integer local integer this=si__baserc_F if(this!=0)then set si__baserc_F=si__baserc_V[this] else set si__baserc_I=si__baserc_I+1 set this=si__baserc_I endif if(this>8190)then return 0 endif set s__baserc_next[this]=0 set s__baserc_rc[this]=null set si__baserc_V[this]=-1 return this endfunction function s__baserc_deallocate takes integer this returns nothing if this==null then return elseif(si__baserc_V[this]!=-1)then return endif set si__baserc_V[this]=si__baserc_F set si__baserc_F=this endfunction function s__PlayerStruct__allocate takes nothing returns integer local integer this=si__PlayerStruct_F if(this!=0)then set si__PlayerStruct_F=si__PlayerStruct_V[this] else set si__PlayerStruct_I=si__PlayerStruct_I+1 set this=si__PlayerStruct_I endif if(this>8190)then return 0 endif set s__PlayerStruct_side[this]=0 set s__PlayerStruct_state[this]=0 set s__PlayerStruct_main[this]=null set s__PlayerStruct_name[this]="" set s__PlayerStruct_allowMini[this]=false set s__PlayerStruct_noLeaveTimer[this]=0 set s__PlayerStruct_actionTimer[this]=0 set s__PlayerStruct_skin[this]=0 set s__PlayerStruct_humanFeed[this]=0 set s__PlayerStruct_vampireGoldLeaks[this]=0 set s__PlayerStruct_vampireWoodLeaks[this]=0 set s__PlayerStruct_vampireGold[this]=0 set si__PlayerStruct_V[this]=-1 set vampDeath[this]=0 return this endfunction function s__PlayerStruct_deallocate takes integer this returns nothing if this==null then return elseif(si__PlayerStruct_V[this]!=-1)then return endif set si__PlayerStruct_V[this]=si__PlayerStruct_F set si__PlayerStruct_F=this endfunction function libAntiDamage__OnTimer takes nothing returns nothing loop exitwhen libAntiDamage__hc==0 set libAntiDamage__hc=libAntiDamage__hc-1 call SetWidgetLife(libAntiDamage__hu[libAntiDamage__hc],GetWidgetLife(libAntiDamage__hu[libAntiDamage__hc])+libAntiDamage__ha[libAntiDamage__hc]) set libAntiDamage__hu[libAntiDamage__hc]=null endloop endfunction function UndoDamage takes unit u,real dmg returns nothing local real life=GetWidgetLife(u) local real maxLife=GetUnitState(u,UNIT_STATE_MAX_LIFE) if life<dmg+1 then if life+dmg>maxLife then call SetWidgetLife(u,maxLife) set libAntiDamage__hu[libAntiDamage__hc]=u set libAntiDamage__ha[libAntiDamage__hc]=life+dmg-maxLife set libAntiDamage__hc=libAntiDamage__hc+1 call TimerStart(libAntiDamage__dt,.0,false,function libAntiDamage__OnTimer) else call SetWidgetLife(u,life+dmg) endif elseif life+dmg>maxLife then set libAntiDamage__hu[libAntiDamage__hc]=u set libAntiDamage__ha[libAntiDamage__hc]=dmg set libAntiDamage__hc=libAntiDamage__hc+1 call TimerStart(libAntiDamage__dt,.0,false,function libAntiDamage__OnTimer) else call SetWidgetLife(u,life+dmg) endif endfunction function HexToInt takes string s returns integer local string hexs="0123456789ABCDEF" local integer i=0 set s=StringCase(s,true) loop exitwhen i>15 if s==SubString(hexs,i,i+1)then return i endif set i=i+1 endloop return-1 endfunction function IntToHex takes integer i returns string local string hexs="0123456789ABCDEF" return SubString(hexs,i,i+1) endfunction function SetNumInt takes integer n,integer i returns nothing local integer length=0 local integer d loop exitwhen i<=0 set d=i/libCode__num_base set libCode__rsa_data[n+length]=i-d*libCode__num_base set i=d set length=length+1 endloop set libCode__rsa_data[n-1]=length endfunction function SetNumString takes integer n,string v returns boolean local integer length=0 local integer i=StringLength(v) local integer j=0 loop exitwhen j>=i if HexToInt(SubString(v,j,j+1))<0 then return false endif set j=j+1 endloop loop exitwhen i<=0 if i==1 then set libCode__rsa_data[n+length]=HexToInt(SubString(v,i-1,i)) elseif i==2 then set libCode__rsa_data[n+length]=HexToInt(SubString(v,i-2,i-1))*16+HexToInt(SubString(v,i-1,i)) else set libCode__rsa_data[n+length]=HexToInt(SubString(v,i-3,i-2))*256+HexToInt(SubString(v,i-2,i-1))*16+HexToInt(SubString(v,i-1,i)) endif set length=length+1 set i=i-3 endloop set libCode__rsa_data[n-1]=length return true endfunction function NumToString takes integer n returns string local string res="" local integer length=libCode__rsa_data[n-1] local integer i=length-1 local integer s if length==0 then return"" endif loop exitwhen i<0 set s=libCode__rsa_data[n+i] if i==length-1 then if s>=256 then set res=res+IntToHex(s/256) set s=s-(s/256)*256 set res=res+IntToHex(s/16)+IntToHex(s-(s/16)*16) elseif s>=16 then set res=res+IntToHex(s/16)+IntToHex(s-(s/16)*16) else set res=res+IntToHex(s) endif else set res=res+IntToHex(s/256) set s=s-(s/256)*256 set res=res+IntToHex(s/16)+IntToHex(s-(s/16)*16) endif set i=i-1 endloop return res endfunction function CopyNum takes integer r,integer n returns nothing local integer length=libCode__rsa_data[n-1] local integer i=0 loop exitwhen i>=length set libCode__rsa_data[r+i]=libCode__rsa_data[n+i] set i=i+1 endloop set libCode__rsa_data[r-1]=length endfunction function AddNum takes integer r,integer a,integer b returns nothing local integer s local integer c=0 local integer i=0 loop exitwhen(c==0)and(i>=libCode__rsa_data[a-1])and(i>=libCode__rsa_data[b-1]) set s=c if i<libCode__rsa_data[a-1]then set s=s+libCode__rsa_data[a+i] endif if i<libCode__rsa_data[b-1]then set s=s+libCode__rsa_data[b+i] endif if s>=libCode__num_base then set c=1 set s=s-libCode__num_base else set c=0 endif set libCode__rsa_data[r+i]=s set i=i+1 endloop set libCode__rsa_data[r-1]=i endfunction function SubNum takes integer r,integer a,integer b returns nothing local integer s local integer c=0 local integer i=0 loop exitwhen(c==0)and(i>=libCode__rsa_data[a-1])and(i>=libCode__rsa_data[b-1]) set s=-c if i<libCode__rsa_data[a-1]then set s=s+libCode__rsa_data[a+i] endif if i<libCode__rsa_data[b-1]then set s=s-libCode__rsa_data[b+i] endif if s<0 then set c=1 set s=s+libCode__num_base else set c=0 endif set libCode__rsa_data[r+i]=s set i=i+1 endloop loop exitwhen i==0 exitwhen libCode__rsa_data[r+i-1]!=0 set i=i-1 endloop set libCode__rsa_data[r-1]=i endfunction function MulNumShort takes integer r,integer a,integer b returns nothing local integer s local integer c=0 local integer i=0 if b==0 then set libCode__rsa_data[r-1]=0 return endif loop exitwhen(c==0)and(i>=libCode__rsa_data[a-1]) set s=c if i<libCode__rsa_data[a-1]then set s=s+libCode__rsa_data[a+i]*b endif set c=s/libCode__num_base set s=s-c*libCode__num_base set libCode__rsa_data[r+i]=s set i=i+1 endloop set libCode__rsa_data[r-1]=i endfunction function MulNum takes integer r,integer a,integer b returns nothing local integer s local integer c local integer i=0 local integer j local integer length=0 loop exitwhen i>=libCode__rsa_data[a-1] set j=0 set c=0 loop exitwhen(c==0)and(j>=libCode__rsa_data[b-1]) set s=c if i+j<length then set s=s+libCode__rsa_data[r+i+j] endif if j<libCode__rsa_data[b-1]then set s=s+libCode__rsa_data[a+i]*libCode__rsa_data[b+j] endif set c=s/libCode__num_base set s=s-c*libCode__num_base set libCode__rsa_data[r+i+j]=s if i+j>=length then set length=i+j+1 endif set j=j+1 endloop set i=i+1 endloop set libCode__rsa_data[r-1]=length endfunction function NumEqual takes integer a,integer b returns boolean local integer length local integer i=0 if libCode__rsa_data[a-1]!=libCode__rsa_data[b-1]then return false endif set length=libCode__rsa_data[a-1] loop exitwhen i>=length if libCode__rsa_data[a+i]!=libCode__rsa_data[b+i]then return false endif set i=i+1 endloop return true endfunction function NumLess takes integer a,integer b returns boolean local integer length local integer i if libCode__rsa_data[a-1]!=libCode__rsa_data[b-1]then return libCode__rsa_data[a-1]<libCode__rsa_data[b-1] endif set i=libCode__rsa_data[a-1]-1 loop exitwhen i<0 if libCode__rsa_data[a+i]!=libCode__rsa_data[b+i]then return libCode__rsa_data[a+i]<libCode__rsa_data[b+i] endif set i=i-1 endloop return false endfunction function NumZero takes integer n returns boolean return libCode__rsa_data[n-1]==0 endfunction function NumEven takes integer n returns boolean local integer d=libCode__rsa_data[n] if libCode__rsa_data[n-1]==0 then return true endif return(d/2)*2==d endfunction function DivNum2 takes integer n returns nothing local integer length=libCode__rsa_data[n-1] local integer i=length-1 local integer c=0 local integer s loop exitwhen i<0 set s=libCode__rsa_data[n+i]+c*libCode__num_base set c=s-(s/2)*2 set libCode__rsa_data[n+i]=s/2 set i=i-1 endloop loop exitwhen length<=0 exitwhen libCode__rsa_data[n+length-1]!=0 set length=length-1 endloop set libCode__rsa_data[n-1]=length endfunction function CopyNumShifted takes integer r,integer n,integer s returns nothing local integer length=libCode__rsa_data[n-1] local integer i=0 if length!=0 then loop exitwhen i>=s set libCode__rsa_data[r+i]=0 set i=i+1 endloop set i=0 loop exitwhen i>=length set libCode__rsa_data[r+i+s]=libCode__rsa_data[n+i] set i=i+1 endloop set libCode__rsa_data[r-1]=length+s else set libCode__rsa_data[r-1]=0 endif endfunction function DivNum takes integer res,integer a,integer b,integer rem returns nothing local integer i=libCode__rsa_data[a-1]-libCode__rsa_data[b-1] local integer l local integer r local integer m local integer length=i+1 call CopyNum(rem,a) if NumLess(a,b)then set libCode__rsa_data[res-1]=0 return endif loop exitwhen i<0 set l=0 set r=libCode__num_base-1 call CopyNumShifted(num_tmp1,b,i) loop exitwhen l>=r set m=(l+r+1)/2 call MulNumShort(num_tmp2,num_tmp1,m) if NumLess(rem,num_tmp2)then set r=m-1 else set l=m endif endloop call MulNumShort(num_tmp2,num_tmp1,l) call SubNum(rem,rem,num_tmp2) set libCode__rsa_data[res+i]=l set i=i-1 endloop loop exitwhen length<=0 exitwhen libCode__rsa_data[res+length-1]!=0 set length=length-1 endloop set libCode__rsa_data[res-1]=length endfunction function PowNumMod takes integer r,integer a,integer b,integer p returns nothing call SetNumInt(r,1) call CopyNum(num_power,b) call CopyNum(num_number,a) loop exitwhen(libCode__rsa_data[(num_power)-1]==0) call TriggerSleepAction(.001) if not NumEven(num_power)then call MulNum(num_tmp3,r,num_number) call DivNum(num_null,num_tmp3,p,r) endif call TriggerSleepAction(.001) call MulNum(num_tmp3,num_number,num_number) call DivNum(num_null,num_tmp3,p,num_number) call DivNum2(num_power) endloop endfunction function RandomKey takes nothing returns string local string key="" local string hexs="0123456789ABCDEF" local integer i=0 local integer d loop exitwhen i>=6 set d=GetRandomInt(0,15) set key=key+SubString(hexs,d,d+1) set i=i+1 endloop return key endfunction function libColor__UnHex takes string s,integer a,integer b returns integer local string hex="0123456789ABCDEF" local string hex2="0123456789abcdef" local integer i local integer r=0 local string c loop exitwhen a>=b set c=SubString(s,a,a+1) set i=0 loop exitwhen i>=16 exitwhen c==SubString(hex,i,i+1) exitwhen c==SubString(hex2,i,i+1) set i=i+1 endloop if i>=16 then set i=0 endif set r=r*16+i set a=a+1 endloop return r endfunction function s__Color_create takes string web returns integer local integer c=s__Color__allocate() set s__Color_web[c]="|cff"+web set s__Color_red[c]=libColor__UnHex(web,0,2) set s__Color_green[c]=libColor__UnHex(web,0,4) set s__Color_blue[c]=libColor__UnHex(web,0,6) return c endfunction function libColor__OnInit takes nothing returns nothing set colors[0]=s__Color_create("FF0303") set colors[1]=s__Color_create("0042FF") set colors[2]=s__Color_create("1CE6B9") set colors[3]=s__Color_create("540081") set colors[4]=s__Color_create("FFFC00") set colors[5]=s__Color_create("FE8A0E") set colors[6]=s__Color_create("20C000") set colors[7]=s__Color_create("E55BB0") set colors[8]=s__Color_create("959697") set colors[9]=s__Color_create("7FBFF1") set colors[10]=s__Color_create("106246") set colors[11]=s__Color_create("492A04") set colors[12]=s__Color_create("FFFFFF") endfunction function libDummyEngine__UnDummy takes nothing returns nothing local integer i=0 loop exitwhen i>=libDummyEngine__dn set libDummyEngine__dc[i]=libDummyEngine__dc[i]-1 if libDummyEngine__dc[i]==0 then call KillUnit(libDummyEngine__da[i]) set libDummyEngine__dn=libDummyEngine__dn-1 set libDummyEngine__da[i]=libDummyEngine__da[libDummyEngine__dn] set libDummyEngine__dc[i]=libDummyEngine__dc[libDummyEngine__dn] set libDummyEngine__da[libDummyEngine__dn]=null else set i=i+1 endif endloop if libDummyEngine__dn==0 then call PauseTimer(libDummyEngine__dt) endif endfunction function CreateDummy takes player p,real x,real y returns unit if isDebug>=2 then set libDummyEngine__da[libDummyEngine__dn]=CreateUnit(p,'h022',x,y,0) else set libDummyEngine__da[libDummyEngine__dn]=CreateUnit(p,'hdum',x,y,0) endif set libDummyEngine__dc[libDummyEngine__dn]=5 if libDummyEngine__dn==0 then call TimerStart(libDummyEngine__dt,1.,true,function libDummyEngine__UnDummy) endif set libDummyEngine__dn=libDummyEngine__dn+1 return libDummyEngine__da[libDummyEngine__dn-1] endfunction function DummySpellTarget takes player p,unit u,integer id,string order returns nothing local unit d=CreateDummy(p,GetUnitX(u),GetUnitY(u)) call UnitAddAbility(d,id) call IssueTargetOrder(d,order,u) set d=null endfunction function DummySpellPoint takes player p,real x,real y,integer id,string order returns nothing local unit d=CreateDummy(p,x,y) call UnitAddAbility(d,id) call IssuePointOrder(d,order,x,y) set d=null endfunction function DummySpellImmediate takes player p,real x,real y,integer id,string order returns nothing local unit d=CreateDummy(p,x,y) call UnitAddAbility(d,id) call IssueImmediateOrder(d,order) set d=null endfunction function ForceAbilityCd takes unit u,string order,integer id returns nothing call UnitAddAbility(u,id) call IssueImmediateOrder(u,order) call UnitRemoveAbility(u,id) endfunction function FlushHandle takes handle h returns nothing call FlushChildHashtable(libHandleVars__ht,GetHandleId(h)) endfunction function SetHandleInt takes handle h,integer i,integer v returns nothing call SaveInteger(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleInt takes handle h,integer i returns integer return LoadInteger(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleBoolean takes handle h,integer i,boolean v returns nothing call SaveBoolean(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleBoolean takes handle h,integer i returns boolean return LoadBoolean(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleReal takes handle h,integer i,real v returns nothing call SaveReal(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleReal takes handle h,integer i returns real return LoadReal(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleString takes handle h,integer i,string v returns nothing call SaveStr(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleString takes handle h,integer i returns string return LoadStr(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandlePlayer takes handle h,integer i,player v returns nothing call SavePlayerHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandlePlayer takes handle h,integer i returns player return LoadPlayerHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleWidget takes handle h,integer i,widget v returns nothing call SaveWidgetHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleWidget takes handle h,integer i returns widget return LoadWidgetHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleDestructable takes handle h,integer i,destructable v returns nothing call SaveDestructableHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleDestructable takes handle h,integer i returns destructable return LoadDestructableHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleItem takes handle h,integer i,item v returns nothing call SaveItemHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleItem takes handle h,integer i returns item return LoadItemHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleUnit takes handle h,integer i,unit v returns nothing call SaveUnitHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleUnit takes handle h,integer i returns unit return LoadUnitHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleAbility takes handle h,integer i,ability v returns nothing call SaveAbilityHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleAbility takes handle h,integer i returns ability return LoadAbilityHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleTimer takes handle h,integer i,timer v returns nothing call SaveTimerHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleTimer takes handle h,integer i returns timer return LoadTimerHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleTrigger takes handle h,integer i,trigger v returns nothing call SaveTriggerHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleTrigger takes handle h,integer i returns trigger return LoadTriggerHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleTriggerCondition takes handle h,integer i,triggercondition v returns nothing call SaveTriggerConditionHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleTriggerCondition takes handle h,integer i returns triggercondition return LoadTriggerConditionHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleTriggerAction takes handle h,integer i,triggeraction v returns nothing call SaveTriggerActionHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleTriggerAction takes handle h,integer i returns triggeraction return LoadTriggerActionHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleTriggerEvent takes handle h,integer i,event v returns nothing call SaveTriggerEventHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleTriggerEvent takes handle h,integer i returns event return LoadTriggerEventHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleForce takes handle h,integer i,force v returns nothing call SaveForceHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleForce takes handle h,integer i returns force return LoadForceHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleGroup takes handle h,integer i,group v returns nothing call SaveGroupHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleGroup takes handle h,integer i returns group return LoadGroupHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleLocation takes handle h,integer i,location v returns nothing call SaveLocationHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleLocation takes handle h,integer i returns location return LoadLocationHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleRect takes handle h,integer i,rect v returns nothing call SaveRectHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleRect takes handle h,integer i returns rect return LoadRectHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleBooleanExpr takes handle h,integer i,boolexpr v returns nothing call SaveBooleanExprHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleBooleanExpr takes handle h,integer i returns boolexpr return LoadBooleanExprHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleSound takes handle h,integer i,sound v returns nothing call SaveSoundHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleSound takes handle h,integer i returns sound return LoadSoundHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleEffect takes handle h,integer i,effect v returns nothing call SaveEffectHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleEffect takes handle h,integer i returns effect return LoadEffectHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleUnitPool takes handle h,integer i,unitpool v returns nothing call SaveUnitPoolHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleUnitPool takes handle h,integer i returns unitpool return LoadUnitPoolHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleItemPool takes handle h,integer i,itempool v returns nothing call SaveItemPoolHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleItemPool takes handle h,integer i returns itempool return LoadItemPoolHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleQuest takes handle h,integer i,quest v returns nothing call SaveQuestHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleQuest takes handle h,integer i returns quest return LoadQuestHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleQuestItem takes handle h,integer i,questitem v returns nothing call SaveQuestItemHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleQuestItem takes handle h,integer i returns questitem return LoadQuestItemHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleDefeatCondition takes handle h,integer i,defeatcondition v returns nothing call SaveDefeatConditionHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleDefeatCondition takes handle h,integer i returns defeatcondition return LoadDefeatConditionHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleTimerDialog takes handle h,integer i,timerdialog v returns nothing call SaveTimerDialogHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleTimerDialog takes handle h,integer i returns timerdialog return LoadTimerDialogHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleLeaderboard takes handle h,integer i,leaderboard v returns nothing call SaveLeaderboardHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleLeaderboard takes handle h,integer i returns leaderboard return LoadLeaderboardHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleMultiboard takes handle h,integer i,multiboard v returns nothing call SaveMultiboardHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleMultiboard takes handle h,integer i returns multiboard return LoadMultiboardHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleMultiboardItem takes handle h,integer i,multiboarditem v returns nothing call SaveMultiboardItemHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleMultiboardItem takes handle h,integer i returns multiboarditem return LoadMultiboardItemHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleTrackable takes handle h,integer i,trackable v returns nothing call SaveTrackableHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleTrackable takes handle h,integer i returns trackable return LoadTrackableHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleDialog takes handle h,integer i,dialog v returns nothing call SaveDialogHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleDialog takes handle h,integer i returns dialog return LoadDialogHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleButton takes handle h,integer i,button v returns nothing call SaveButtonHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleButton takes handle h,integer i returns button return LoadButtonHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleTextTag takes handle h,integer i,texttag v returns nothing call SaveTextTagHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleTextTag takes handle h,integer i returns texttag return LoadTextTagHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleLightning takes handle h,integer i,lightning v returns nothing call SaveLightningHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleLightning takes handle h,integer i returns lightning return LoadLightningHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleImage takes handle h,integer i,image v returns nothing call SaveImageHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleImage takes handle h,integer i returns image return LoadImageHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleUbersplat takes handle h,integer i,ubersplat v returns nothing call SaveUbersplatHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleUbersplat takes handle h,integer i returns ubersplat return LoadUbersplatHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleRegion takes handle h,integer i,region v returns nothing call SaveRegionHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleRegion takes handle h,integer i returns region return LoadRegionHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleFogState takes handle h,integer i,fogstate v returns nothing call SaveFogStateHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleFogState takes handle h,integer i returns fogstate return LoadFogStateHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleFogModifier takes handle h,integer i,fogmodifier v returns nothing call SaveFogModifierHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleFogModifier takes handle h,integer i returns fogmodifier return LoadFogModifierHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function SetHandleHashtable takes handle h,integer i,hashtable v returns nothing call SaveHashtableHandle(libHandleVars__ht,GetHandleId(h),i,v) endfunction function GetHandleHashtable takes handle h,integer i returns hashtable return LoadHashtableHandle(libHandleVars__ht,GetHandleId(h),i) endfunction function libHandleVars__OnInit takes nothing returns nothing set libHandleVars__ht=InitHashtable() endfunction function PlayerData takes player p returns integer return players[GetPlayerId(p)] endfunction function region__OnInit takes nothing returns nothing set center=CreateRegion() call RegionAddRect(center,gg_rct_Center_Right) call RegionAddRect(center,gg_rct_Center_Main) call RegionAddRect(center,gg_rct_Center_Bottom) call RegionAddRect(center,gg_rct_Center_Left) call RegionAddRect(center,gg_rct_Center_Top_Left) call RegionAddRect(center,gg_rct_Center_Top) call RegionAddRect(center,gg_rct_Center_Top_Right) call RegionAddRect(center,gg_rct_Center_Top_Small) call RegionAddRect(center,gg_rct_Center_Bottom_Small) call RegionAddRect(center,gg_rct_Center_Left_Small) endfunction function TriggerRegisterAnyUnitEvent takes trigger whichTrigger,playerunitevent whichEvent,boolexpr filter returns nothing local integer i=0 loop exitwhen i>11 call TriggerRegisterPlayerUnitEvent(whichTrigger,Player(i),whichEvent,filter) set i=i+1 endloop endfunction function TriggerRegisterAnyPlayerChatEvent takes trigger whichTrigger,string chatMessageToDetect,boolean exactMatchOnly returns nothing local integer i=0 loop exitwhen i>11 call TriggerRegisterPlayerChatEvent(whichTrigger,Player(i),chatMessageToDetect,exactMatchOnly) set i=i+1 endloop endfunction function MoveUnitToRect takes unit u,rect r returns nothing call SetUnitPosition(u,GetRandomReal(GetRectMinX(r),GetRectMaxX(r)),GetRandomReal(GetRectMinY(r),GetRectMaxY(r))) endfunction function libBase__EndFog takes nothing returns nothing call ResetTerrainFog() call StopMusic(true) endfunction function TimedFog takes real t,integer style,real zstart,real zend,real density,real red,real green,real blue,string music returns nothing call SetTerrainFogEx(style,zstart,zend,density,red,green,blue) if music!="" then call PlayThematicMusic(music) endif call TimerStart(libBase__fogTimer,t,false,function libBase__EndFog) endfunction function InterfaceError takes player p,string s returns nothing local sound snd=CreateSoundFromLabel("InterfaceError",false,false,false,10,10) if GetLocalPlayer()==p then if s!="" and s!=null then call ClearTextMessages() call DisplayTimedTextToPlayer(p,.5,-1.,2.,"|cffffcc00"+s+"|r") endif call StartSound(snd) endif call KillSoundWhenDone(snd) endfunction function TimeString takes real t returns string local integer it=R2I(t) local integer x=it/60 local integer y=it-x*60 if y<10 then return I2S(x)+":0"+I2S(y) else return I2S(x)+":"+I2S(y) endif endfunction function VictoryHuman takes nothing returns nothing call TriggerEvaluate(gg_trg_victoryHuman) endfunction function VictoryVampire takes nothing returns nothing call TriggerEvaluate(gg_trg_victoryVampire) endfunction function GoldMineIncome takes nothing returns integer return numVampires/2+1+Income_Add endfunction function IsHuman takes unit u returns boolean return u!=null and IsUnitType(u,UNIT_TYPE_PEON)and GetUnitTypeId(u)!='h00Q' endfunction function IsVampire takes unit u returns boolean local integer id if u==null then return false endif set id=GetUnitTypeId(u) if id=='E000' or id=='E001' or id=='E002' or id=='AVFV' then return true elseif id=='U00C' or id=='U00B' or id=='U00K' or id=='U00D' then return true elseif id=='U009' or id=='U007' or id=='U008' or id=='U00A' then return true else return false endif endfunction function IsSlayer takes unit u returns boolean return GetUnitTypeId(u)=='HSyM' or GetUnitTypeId(u)=='H01L' endfunction function IsWall takes unit u returns boolean return GetUnitTypeId(u)=='h001' or GetUnitTypeId(u)=='h000' or GetUnitTypeId(u)=='h003' or GetUnitTypeId(u)=='h005' or GetUnitTypeId(u)=='h006' or GetUnitTypeId(u)=='h00Z' or GetUnitTypeId(u)=='h01R' or GetUnitTypeId(u)=='h00E' or GetUnitTypeId(u)=='h00F' or GetUnitTypeId(u)=='h00P' endfunction function IsHarvester takes unit u returns boolean local integer id=GetUnitTypeId(u) return id=='hWkr' or id=='h007' or id=='h00A' or id=='h00K' or id=='h00T' endfunction function GetGender takes unit u returns integer local integer id=GetUnitTypeId(u) if id=='h00V' or id=='AVFV' or id=='H01L' or id=='U009' or id=='U007' or id=='U008' or id=='U00A' or id=='h017' or id=='h016' or id=='h01W' then return GENDER_FEMALE else return GENDER_MALE endif endfunction function GetGenderHis takes player p returns string local integer d=players[GetPlayerId(p)] if s__PlayerStruct_main[d]==null or GetGender(s__PlayerStruct_main[d])==GENDER_MALE then return"his" else return"her" endif endfunction function GetGenderHe takes player p returns string local integer d=players[GetPlayerId(p)] if s__PlayerStruct_main[d]==null or GetGender(s__PlayerStruct_main[d])==GENDER_MALE then return"he" else return"she" endif endfunction function ExplodeUnit takes unit u returns nothing if not IsUnitType(u,UNIT_TYPE_DEAD)then if IsUnitType(u,UNIT_TYPE_STRUCTURE)then call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Human\\HCancelDeath\\HCancelDeath.mdl",GetUnitX(u),GetUnitY(u))) else call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Human\\HumanLargeDeathExplode\\HumanLargeDeathExplode.mdl",GetUnitX(u),GetUnitY(u))) endif endif call RemoveUnit(u) endfunction function GetPlayerNameColored takes player p returns string return s__Color_web[colors[GetPlayerId(p)]]+s__PlayerStruct_name[players[GetPlayerId(p)]]+"|r" endfunction function AddResources takes player p,integer gold,integer lumber returns nothing call SetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD)+gold) call SetPlayerState(p,PLAYER_STATE_RESOURCE_LUMBER,GetPlayerState(p,PLAYER_STATE_RESOURCE_LUMBER)+lumber) endfunction function GetPlayerByName takes string s returns player local integer i=0 local integer j local string o set s=StringCase(s,false) if s=="red" or s=="1" then return Player(0) elseif s=="blue" or s=="2" then return Player(1) elseif s=="teal" or s=="cyan" or s=="3" then return Player(2) elseif s=="purple" or s=="4" then return Player(3) elseif s=="yellow" or s=="5" then return Player(4) elseif s=="orange" or s=="6" then return Player(5) elseif s=="green" or s=="7" then return Player(6) elseif s=="pink" or s=="8" then return Player(7) elseif s=="gray" or s=="grey" or s=="9" then return Player(8) elseif s=="light blue" or s=="lightblue" or s=="lb" or s=="10" then return Player(9) elseif s=="dark green" or s=="darkgreen" or s=="dg" or s=="11" then return Player(10) elseif s=="brown" or s=="12" then return Player(11) endif loop exitwhen i>11 set j=0 set o=StringCase(GetPlayerName(Player(i)),false) loop exitwhen j>StringLength(o)-StringLength(s) if SubString(o,j,j+StringLength(s))==s then return Player(i) endif set j=j+1 endloop set i=i+11 endloop return null endfunction function DisplayAmounts takes integer i returns nothing local player p=GetLocalPlayer() if i!=12 then set p=Player(i) endif call DisplayTimedTextToPlayer(p,0,0,20.,"There are "+I2S(numHumans)+" humans and "+I2S(numVampires)+" vampires in game, goldmine income is now "+I2S(GoldMineIncome())) endfunction function UpdateAmounts takes boolean show returns nothing local integer i=0 set numHumans=0 set numVampires=0 loop exitwhen i>11 if s__PlayerStruct_state[players[i]]==STATE_PLAYING then if s__PlayerStruct_side[players[i]]==SIDE_HUMAN then set numHumans=numHumans+1 elseif s__PlayerStruct_side[players[i]]==SIDE_VAMPIRE or s__PlayerStruct_side[players[i]]==SIDE_MINION then set numVampires=numVampires+1 endif endif set i=i+1 endloop if(not gameOver)and hadHumans and hadVampires then if numHumans==0 then call TriggerEvaluate(gg_trg_victoryVampire) elseif numVampires==0 then call TriggerEvaluate(gg_trg_victoryHuman) else if show then call DisplayAmounts(12) endif endif endif endfunction function XCreateTrigger takes nothing returns trigger set libBase__xTriggers[libBase__xNumTriggers]=CreateTrigger() set libBase__xNumTriggers=libBase__xNumTriggers+1 return libBase__xTriggers[libBase__xNumTriggers-1] endfunction function DisableTriggers takes nothing returns nothing local integer i=0 loop exitwhen i>=libBase__xNumTriggers call DisableTrigger(libBase__xTriggers[i]) set i=i+1 endloop endfunction function libBase__OnBigTimer takes nothing returns nothing set libBase__bigGameTime=libBase__bigGameTime+1234 call TimerStart(libBase__bigGameTimer,1234,false,function libBase__OnBigTimer) endfunction function libBase__StartTime takes nothing returns nothing call TimerStart(libBase__bigGameTimer,1234,false,function libBase__OnBigTimer) endfunction function libBase__OnInit takes nothing returns nothing local integer i=0 loop exitwhen i>11 set players[i]=s__PlayerStruct__allocate() set s__PlayerStruct_name[players[i]]=GetPlayerName(Player(i)) set i=i+1 endloop set vampTypes[0]='E001' set vampTypes[1]='E002' set vampTypes[2]='AVFV' set vampTypes[3]='E000' set numVampTypes=4 endfunction function Multiboard__MultiboardSetItem takes integer row,integer column,string text returns nothing local multiboarditem it=MultiboardGetItem(Multiboard__mb,row,column) call MultiboardSetItemValue(it,text) call MultiboardReleaseItem(it) set it=null endfunction function UpdateMultiboardPlayer takes integer p returns nothing local string name local integer i=0 local boolean ismax=true local boolean ismin=true if Multiboard__mb==null or Multiboard__PlayerRow[p]==0 then return endif if s__PlayerStruct_state[players[p]]==STATE_PLAYING then set name=s__Color_web[colors[p]]+GetPlayerName(Player(p))+"|r" else set name="|cff808080"+GetPlayerName(Player(p))+"|r" endif call Multiboard__MultiboardSetItem(Multiboard__PlayerRow[p],0,name) if IsPlayerAlly(Player(p),GetLocalPlayer())then call Multiboard__MultiboardSetItem(Multiboard__PlayerRow[p],1,"|cffffcc00"+I2S(GetPlayerState(Player(p),PLAYER_STATE_RESOURCE_GOLD))+"|r") call Multiboard__MultiboardSetItem(Multiboard__PlayerRow[p],2,"|cff9dbb61"+I2S(GetPlayerState(Player(p),PLAYER_STATE_RESOURCE_LUMBER))+"|r") else call Multiboard__MultiboardSetItem(Multiboard__PlayerRow[p],1,"-") call Multiboard__MultiboardSetItem(Multiboard__PlayerRow[p],2,"-") endif if s__PlayerStruct_side[players[p]]==SIDE_HUMAN and s__PlayerStruct_humanFeed[players[p]]>0 then loop exitwhen i>11 if s__PlayerStruct_side[players[i]]==SIDE_HUMAN then if s__PlayerStruct_humanFeed[players[i]]>s__PlayerStruct_humanFeed[players[p]]then set ismax=false elseif s__PlayerStruct_humanFeed[players[i]]<s__PlayerStruct_humanFeed[players[p]]then set ismin=false endif endif set i=i+1 endloop if ismax then call Multiboard__MultiboardSetItem(Multiboard__PlayerRow[p],3,"|cffff0404"+I2S(s__PlayerStruct_humanFeed[players[p]])+"|r") elseif ismin then call Multiboard__MultiboardSetItem(Multiboard__PlayerRow[p],3,"|cff20c000"+I2S(s__PlayerStruct_humanFeed[players[p]])+"|r") else call Multiboard__MultiboardSetItem(Multiboard__PlayerRow[p],3,"|cffffcc00"+I2S(s__PlayerStruct_humanFeed[players[p]])+"|r") endif elseif(s__PlayerStruct_side[players[p]]==SIDE_VAMPIRE or s__PlayerStruct_side[players[p]]==SIDE_MINION)and(s__PlayerStruct_vampireGoldLeaks[players[p]]>0 or s__PlayerStruct_vampireWoodLeaks[players[p]]>0)then loop exitwhen i>11 if s__PlayerStruct_side[players[i]]==SIDE_VAMPIRE or s__PlayerStruct_side[players[i]]==SIDE_MINION then if(s__PlayerStruct_vampireGoldLeaks[players[i]]+s__PlayerStruct_vampireWoodLeaks[players[i]])>(s__PlayerStruct_vampireGoldLeaks[players[p]]+s__PlayerStruct_vampireWoodLeaks[players[p]])then set ismax=false elseif(s__PlayerStruct_vampireGoldLeaks[players[i]]+s__PlayerStruct_vampireWoodLeaks[players[i]])<(s__PlayerStruct_vampireGoldLeaks[players[p]]+s__PlayerStruct_vampireWoodLeaks[players[p]])then set ismin=false endif endif set i=i+1 endloop if ismax then call Multiboard__MultiboardSetItem(Multiboard__PlayerRow[p],3,"|cffff0404"+I2S(s__PlayerStruct_vampireGoldLeaks[players[p]])+"/"+I2S(s__PlayerStruct_vampireWoodLeaks[players[p]])+"|r") elseif ismin then call Multiboard__MultiboardSetItem(Multiboard__PlayerRow[p],3,"|cff20c000"+I2S(s__PlayerStruct_vampireGoldLeaks[players[p]])+"/"+I2S(s__PlayerStruct_vampireWoodLeaks[players[p]])+"|r") else call Multiboard__MultiboardSetItem(Multiboard__PlayerRow[p],3,"|cffffcc00"+I2S(s__PlayerStruct_vampireGoldLeaks[players[p]])+"/"+I2S(s__PlayerStruct_vampireWoodLeaks[players[p]])+"|r") endif endif endfunction function Multiboard__UpdateTime takes nothing returns nothing local integer i=0 if Multiboard__mb==null then return endif call MultiboardSetTitleText(Multiboard__mb,"Game time: "+TimeString((libBase__bigGameTime+TimerGetElapsed(libBase__bigGameTimer)))) loop exitwhen i>11 call UpdateMultiboardPlayer(i) set i=i+1 endloop endfunction function UpdateMultiboard takes nothing returns nothing local integer i=0 local multiboarditem it local integer cnt=0 local boolean hhu=false local boolean hva=false local boolean minimized=true loop exitwhen i>15 set Multiboard__PlayerRow[i]=0 set i=i+1 endloop if not Multiboard__allowmb then return endif if Multiboard__mb!=null then set minimized=IsMultiboardMinimized(Multiboard__mb) call DestroyMultiboard(Multiboard__mb) endif set Multiboard__mb=CreateMultiboard() set i=0 loop exitwhen i>11 if s__PlayerStruct_state[players[i]]!=0 then if s__PlayerStruct_side[players[i]]==SIDE_HUMAN then set cnt=cnt+1 set hhu=true elseif s__PlayerStruct_side[players[i]]==SIDE_VAMPIRE or s__PlayerStruct_side[players[i]]==SIDE_MINION then set cnt=cnt+1 set hva=true endif endif set i=i+1 endloop if hhu then set cnt=cnt+1 endif if hva then set cnt=cnt+1 endif call MultiboardSetRowCount(Multiboard__mb,cnt) call MultiboardSetColumnCount(Multiboard__mb,4) set i=0 loop exitwhen i>=cnt set it=MultiboardGetItem(Multiboard__mb,i,0) call MultiboardSetItemStyle(it,true,false) call MultiboardSetItemWidth(it,.12) call MultiboardReleaseItem(it) set it=MultiboardGetItem(Multiboard__mb,i,1) call MultiboardSetItemStyle(it,true,false) call MultiboardSetItemWidth(it,.05) call MultiboardReleaseItem(it) set it=MultiboardGetItem(Multiboard__mb,i,2) call MultiboardSetItemStyle(it,true,false) call MultiboardSetItemWidth(it,.05) call MultiboardReleaseItem(it) set it=MultiboardGetItem(Multiboard__mb,i,3) call MultiboardSetItemStyle(it,true,false) call MultiboardSetItemWidth(it,.04) call MultiboardReleaseItem(it) set i=i+1 endloop set cnt=0 if hhu then call Multiboard__MultiboardSetItem(0,0,"Humans") call Multiboard__MultiboardSetItem(0,1,"Gold") call Multiboard__MultiboardSetItem(0,2,"Lumber") call Multiboard__MultiboardSetItem(0,3,"Fed") set cnt=1 set i=0 loop exitwhen i>11 if s__PlayerStruct_state[players[i]]!=0 and s__PlayerStruct_side[players[i]]==SIDE_HUMAN then set Multiboard__PlayerRow[i]=cnt set cnt=cnt+1 endif set i=i+1 endloop endif if hva then call Multiboard__MultiboardSetItem(cnt,0,"Vampires") call Multiboard__MultiboardSetItem(cnt,1,"Gold") call Multiboard__MultiboardSetItem(cnt,2,"Lumber") call Multiboard__MultiboardSetItem(cnt,3,"Leaked") set cnt=cnt+1 set i=0 loop exitwhen i>11 if s__PlayerStruct_state[players[i]]!=0 and(s__PlayerStruct_side[players[i]]==SIDE_VAMPIRE or s__PlayerStruct_side[players[i]]==SIDE_MINION)then set Multiboard__PlayerRow[i]=cnt set cnt=cnt+1 endif set i=i+1 endloop endif call Multiboard__UpdateTime() call MultiboardDisplay(Multiboard__mb,true) call MultiboardMinimize(Multiboard__mb,minimized) set it=null endfunction function UpdateMultiboardTimed takes real t returns nothing call TimerStart(Multiboard__mbTimer,t,false,function UpdateMultiboard) endfunction function Multiboard__StartMultiboard takes nothing returns nothing local timer t=CreateTimer() call TimerStart(t,1,true,function Multiboard__UpdateTime) set t=null set Multiboard__allowmb=true call UpdateMultiboard() call DestroyTimer(GetExpiredTimer()) endfunction function Multiboard__InitMultiboard takes nothing returns nothing local timer t=CreateTimer() call TimerStart(t,.0,false,function Multiboard__StartMultiboard) set t=null endfunction function ShareGold takes integer p returns nothing local integer gp=GetPlayerState(Player(p),PLAYER_STATE_RESOURCE_GOLD) local integer wd=GetPlayerState(Player(p),PLAYER_STATE_RESOURCE_LUMBER) local integer allycount=0 local integer i=0 local integer curg local integer curw call SetPlayerState(Player(p),PLAYER_STATE_RESOURCE_GOLD,0) call SetPlayerState(Player(p),PLAYER_STATE_RESOURCE_LUMBER,0) loop exitwhen i>11 if IsPlayerAlly(Player(p),Player(i))and s__PlayerStruct_state[players[i]]==STATE_PLAYING and i!=p then set allycount=allycount+1 endif set i=i+1 endloop if allycount>0 then set i=0 loop exitwhen i>11 if IsPlayerAlly(Player(p),Player(i))and s__PlayerStruct_state[players[i]]==STATE_PLAYING and i!=p then set curg=gp/allycount set curw=wd/allycount call AddResources(Player(i),curg,curw) if curg>0 then if curw>0 then call DisplayTextToPlayer(Player(i),0,0,"|cffffcc00Received "+I2S(curg)+" gold and "+I2S(curw)+" lumber from "+GetPlayerNameColored(Player(p))) else call DisplayTextToPlayer(Player(i),0,0,"|cffffcc00Received "+I2S(curg)+" gold from "+GetPlayerNameColored(Player(p))) endif elseif curw>0 then call DisplayTextToPlayer(Player(i),0,0,"|cff9dbb61Received "+I2S(curw)+" lumber from "+GetPlayerNameColored(Player(p))) endif set gp=gp-curg set wd=wd-curw set allycount=allycount-1 endif set i=i+1 endloop endif endfunction function ShareVampItems takes integer p returns nothing local unit u=CreateUnit(Player(p),'n003',0,-256,0) local integer i=0 local integer cnt=0 local item it loop exitwhen i>5 set it=UnitItemInSlot(s__PlayerStruct_main[players[p]],i) if it!=null and GetItemTypeId(it)!='I01I' then call SetItemCharges(UnitAddItemById(u,GetItemTypeId(it)),GetItemCharges(it)) call RemoveItem(it) set cnt=cnt+1 endif set i=i+1 endloop if cnt!=0 then set ShareGold__eyes[ShareGold__neyes]=u set ShareGold__neyes=ShareGold__neyes+1 if ShareGold__neyes>1 then set i=0 loop exitwhen i>=ShareGold__neyes call ShowUnit(ShareGold__eyes[i],false) call SetUnitX(ShareGold__eyes[i],-256-256*Cos(bj_PI*2*i/ShareGold__neyes)) call SetUnitY(ShareGold__eyes[i],-512+256*Sin(bj_PI*2*i/ShareGold__neyes)) call ShowUnit(ShareGold__eyes[i],true) set i=i+1 endloop endif set i=0 loop exitwhen i>11 if(s__PlayerStruct_side[players[i]]==SIDE_VAMPIRE or s__PlayerStruct_side[players[i]]==SIDE_MINION)and s__PlayerStruct_state[players[i]]==STATE_PLAYING then call SetPlayerAlliance(Player(p),Player(i),ALLIANCE_SHARED_CONTROL,true) if GetLocalPlayer()==Player(i)then call DisplayTextToPlayer(GetLocalPlayer(),0,0,GetPlayerNameColored(Player(p))+"|cffffcc00 has left behind some artifacts hidden in a part of his soul|r") call PingMinimap(-256,-512,5.) endif endif set i=i+1 endloop else call ShowUnit(u,false) call KillUnit(u) endif set u=null set it=null endfunction function GetUnitGoldCost takes integer unitid returns integer return LoadInteger(libBaseClaims__bctable,unitid,libBaseClaims__HASH_GOLD) endfunction function GetUnitWoodCost takes integer unitid returns integer return LoadInteger(libBaseClaims__bctable,unitid,libBaseClaims__HASH_WOOD) endfunction function RegisterUnitCost takes integer unitid,integer gold,integer wood returns nothing call SaveInteger(libBaseClaims__bctable,unitid,libBaseClaims__HASH_GOLD,gold) call SaveInteger(libBaseClaims__bctable,unitid,libBaseClaims__HASH_WOOD,wood) endfunction function CreateBase takes string name returns integer local integer b=s__base__allocate() set s__base_next[b]=libBaseClaims__bfirst set s__base_name[b]=name set s__base_reclaim[b]=CreateTimer() set libBaseClaims__bfirst=b call SaveInteger(libHandleVars__ht,GetHandleId((s__base_reclaim[b])),(HASH_ATTACH0),(b)) return b endfunction function BaseAddRect takes integer b,rect r returns nothing local integer rc=s__baserc__allocate() set s__baserc_rc[rc]=r set s__baserc_next[rc]=s__base_first[b] set s__base_first[b]=rc endfunction function BaseContainsPoint takes integer b,real x,real y returns boolean local integer rc=s__base_first[b] loop exitwhen rc==0 if x>=GetRectMinX(s__baserc_rc[rc])and x<=GetRectMaxX(s__baserc_rc[rc])and y>=GetRectMinY(s__baserc_rc[rc])and y<=GetRectMaxY(s__baserc_rc[rc])then return true endif set rc=s__baserc_next[rc] endloop return false endfunction function BaseCount takes integer b returns integer local integer rc=s__base_first[b] local integer c=0 loop exitwhen rc==0 set c=c+1 set rc=s__baserc_next[rc] endloop return c endfunction function GetBase takes real x,real y returns integer local integer b=libBaseClaims__bfirst loop exitwhen b==0 if BaseContainsPoint(b,x,y)then return b endif set b=s__base_next[b] endloop return 0 endfunction function BaseHasOwner takes integer b returns boolean return s__base_owner[b]!=null endfunction function BaseUnclaim takes integer b returns nothing local group g local unit u if s__base_owner[b]!=null then set g=CreateGroup() call GroupEnumUnitsOfType(g,UnitId2String(flagID),null) loop set u=FirstOfGroup(g) exitwhen u==null call GroupRemoveUnit(g,u) if GetOwningPlayer(u)==s__base_owner[b]and BaseContainsPoint(b,GetUnitX(u),GetUnitY(u))then call RemoveUnit(u) endif endloop call DestroyGroup(g) set g=null endif set s__base_owner[b]=null set s__base_strength[b]=0 endfunction function GetPlayerBase takes player p returns integer local integer b=libBaseClaims__bfirst loop exitwhen b==0 if s__base_owner[b]==p then return b endif set b=s__base_next[b] endloop return 0 endfunction function PingBase takes integer b,real dur returns nothing local integer clr if s__base_first[b]!=0 and s__baserc_rc[s__base_first[b]]!=null then if s__PlayerStruct_side[(players[GetPlayerId((GetLocalPlayer()))])]==SIDE_HUMAN and s__base_owner[b]!=null then set clr=colors[GetPlayerId(s__base_owner[b])] call PingMinimapEx(GetRectCenterX(s__baserc_rc[s__base_first[b]]),GetRectCenterY(s__baserc_rc[s__base_first[b]]),dur,s__Color_red[clr],s__Color_green[clr],s__Color_blue[clr],false) endif endif endfunction function PingAllBases takes real dur returns nothing local integer b=libBaseClaims__bfirst loop exitwhen b==0 call PingBase(b,dur) set b=s__base_next[b] endloop endfunction function BaseClaim takes integer b,player p,integer strength returns nothing local integer i=0 call BaseUnclaim(b) if s__base_owner[b]==null then set s__base_owner[b]=p set s__base_strength[b]=strength loop exitwhen i>15 set s___base_allowed[s__base_allowed[b]+i]=false set i=i+1 endloop if strength>=2 then call PingBase(b,3.) else call PingBase(b,1.) endif set s___base_allowed[s__base_allowed[b]+GetPlayerId(p)]=true endif endfunction function BasePlayerAllowed takes integer b,player p returns boolean return b==0 or s__base_owner[b]==null or s___base_allowed[s__base_allowed[b]+GetPlayerId(p)]or s__base_strength[b]<2 endfunction function BaseHasFlag takes integer b returns boolean local group g local unit u if s__base_owner[b]!=null then set g=CreateGroup() call GroupEnumUnitsOfType(g,UnitId2String(flagID),null) loop set u=FirstOfGroup(g) exitwhen u==null call GroupRemoveUnit(g,u) if GetOwningPlayer(u)==s__base_owner[b]and BaseContainsPoint(b,GetUnitX(u),GetUnitY(u))then call DestroyGroup(g) set g=null set u=null return true endif endloop call DestroyGroup(g) endif set u=null set g=null return false endfunction function PlayerUnclaim takes player p returns nothing local integer b=GetPlayerBase(p) if b!=0 then call BaseUnclaim(b) endif endfunction function UnitProtected takes unit u returns boolean local integer b=GetBase(GetUnitX(u),GetUnitY(u)) return b!=0 and s__base_owner[b]==GetOwningPlayer(u) endfunction function UnitExposedTo takes unit u,player p returns boolean local integer b=GetBase(GetUnitX(u),GetUnitY(u)) return(not IsHuman(u))and b!=0 and s__base_owner[b]==p endfunction function libBaseClaims__OnBuild takes nothing returns boolean local unit u=GetConstructingStructure() local integer b=GetBase(GetUnitX(u),GetUnitY(u)) local integer o local player p=GetOwningPlayer(u) if s__PlayerStruct_side[(players[GetPlayerId((p))])]!=SIDE_HUMAN then return false endif if not BasePlayerAllowed(b,p)then call AddResources(p,(LoadInteger(libBaseClaims__bctable,(GetUnitTypeId(u)),libBaseClaims__HASH_GOLD)),(LoadInteger(libBaseClaims__bctable,(GetUnitTypeId(u)),libBaseClaims__HASH_WOOD))) call ExplodeUnit(u) call DisplayTextToPlayer(p,0,0,GetPlayerNameColored(s__base_owner[b])+" has claimed this base!") elseif b!=0 and s__base_owner[b]==null then set o=GetPlayerBase(p) if o!=0 and(GetUnitTypeId(u)==flagID or s__base_strength[o]<2)then call BaseUnclaim(o) set o=0 endif if o==0 then if GetUnitTypeId(u)==flagID then call BaseClaim(b,p,2) if IsPlayerAlly(GetLocalPlayer(),p)then call DisplayTextToPlayer(GetLocalPlayer(),0,0,GetPlayerNameColored(p)+" has claimed base "+s__base_name[b]+"!") endif else call BaseClaim(b,p,1) endif endif elseif GetUnitTypeId(u)==flagID and(b!=0 and s__base_owner[b]==p and s__base_strength[b]<2)then set s__base_strength[b]=2 if IsPlayerAlly(GetLocalPlayer(),p)then call DisplayTextToPlayer(GetLocalPlayer(),0,0,GetPlayerNameColored(p)+" has claimed base "+s__base_name[b]+"!") call PingBase(b,3.) endif elseif GetUnitTypeId(u)==flagID and(b==0 or s__base_owner[b]!=p)then call AddResources(p,(LoadInteger(libBaseClaims__bctable,(GetUnitTypeId(u)),libBaseClaims__HASH_GOLD)),(LoadInteger(libBaseClaims__bctable,(GetUnitTypeId(u)),libBaseClaims__HASH_WOOD))) call ExplodeUnit(u) call DisplayTextToPlayer(p,0,0,"You can only build the "+GetUnitName(u)+" in your own base!") endif set u=null set p=null return false endfunction function libBaseClaims__OnTextCommand takes nothing returns boolean local player p=GetTriggerPlayer() local string s=StringCase(GetEventPlayerChatString(),false) local player o local integer b=GetPlayerBase(p) if b==0 then set p=null return false endif if s=="-unclaim" then call BaseUnclaim(b) elseif SubString(s,0,7)=="-allow " then set s=SubString(s,7,StringLength(s)) set o=GetPlayerByName(s) if o==null or s__PlayerStruct_side[(players[GetPlayerId((o))])]!=SIDE_HUMAN then call DisplayTextToPlayer(p,0,0,"Cannot allow this player!") else if not s___base_allowed[s__base_allowed[b]+GetPlayerId(o)]then call DisplayTextToPlayer(o,0,0,GetPlayerNameColored(p)+" has allowed you to build in his/her base.") call DisplayTextToPlayer(p,0,0,"You have allowed "+GetPlayerNameColored(o)+" to build in your base.") else call DisplayTextToPlayer(p,0,0,"You have already allowed "+GetPlayerNameColored(o)+" to build in your base.") endif set s___base_allowed[s__base_allowed[b]+GetPlayerId(o)]=true endif elseif SubString(s,0,9)=="-unallow " then set s=SubString(s,9,StringLength(s)) set o=GetPlayerByName(s) if o==null or s__PlayerStruct_side[(players[GetPlayerId((o))])]!=SIDE_HUMAN then call DisplayTextToPlayer(p,0,0,"Cannot unallow this player!") else if s___base_allowed[s__base_allowed[b]+GetPlayerId(o)]then call DisplayTextToPlayer(o,0,0,GetPlayerNameColored(p)+" has denied your ability to build in his/her base.") call DisplayTextToPlayer(p,0,0,"You have denied "+GetPlayerNameColored(p)+"'s ability to build in your base.") else call DisplayTextToPlayer(p,0,0,GetPlayerNameColored(p)+" was not allowed to build in your base.") endif set s___base_allowed[s__base_allowed[b]+GetPlayerId(o)]=false endif endif set p=null set o=null return false endfunction function libBaseClaims__ReclaimBase takes nothing returns nothing local timer t=GetExpiredTimer() local integer b=(LoadInteger(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH0))) local player p=(LoadPlayerHandle(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH1))) local unit u=s__PlayerStruct_main[(players[GetPlayerId((p))])] if IsHuman(u)and BaseContainsPoint(b,GetUnitX(u),GetUnitY(u))then call BaseClaim(b,p,1) if IsPlayerAlly(GetLocalPlayer(),p)then call DisplayTextToPlayer(GetLocalPlayer(),0,0,s__base_name[b]+" has been reclaimed by "+GetPlayerNameColored(p)+".") endif endif call PauseTimer(t) set t=null set p=null endfunction function libBaseClaims__OnDestroy takes nothing returns boolean local unit u=GetDyingUnit() local player p=GetOwningPlayer(u) local integer b=GetPlayerBase(p) local unit h=s__PlayerStruct_main[(players[GetPlayerId((p))])] if IsHuman(h)and IsUnitType(u,UNIT_TYPE_STRUCTURE)and IsUnitEnemy(GetKillingUnit(),p)then if BaseContainsPoint(b,GetUnitX(u),GetUnitY(u))and(not BaseContainsPoint(b,GetUnitX(h),GetUnitY(h)))then call BaseUnclaim(b) call PauseTimer(s__base_reclaim[b]) call SavePlayerHandle(libHandleVars__ht,GetHandleId((s__base_reclaim[b])),(HASH_ATTACH1),(p)) call TimerStart(s__base_reclaim[b],30,false,function libBaseClaims__ReclaimBase) if IsPlayerAlly(GetLocalPlayer(),p)then call DisplayTextToPlayer(GetLocalPlayer(),0,0,s__base_name[b]+" (owned by "+GetPlayerNameColored(p)+") is being destroyed and has been unclaimed.") endif endif endif set u=null set p=null set h=null return false endfunction function libBaseClaims__OnInit takes nothing returns nothing local integer i=0 local trigger btrig=XCreateTrigger() local trigger ctrig=XCreateTrigger() local trigger dtrig=XCreateTrigger() loop exitwhen i>11 call TriggerRegisterPlayerUnitEvent(btrig,Player(i),EVENT_PLAYER_UNIT_CONSTRUCT_START,null) call TriggerRegisterPlayerChatEvent(ctrig,Player(i),"-unclaim",true) call TriggerRegisterPlayerChatEvent(ctrig,Player(i),"-allow",false) call TriggerRegisterPlayerChatEvent(ctrig,Player(i),"-unallow",false) call TriggerRegisterPlayerUnitEvent(dtrig,Player(i),EVENT_PLAYER_UNIT_DEATH,null) set i=i+1 endloop call TriggerAddCondition(btrig,Condition(function libBaseClaims__OnBuild)) call TriggerAddCondition(ctrig,Condition(function libBaseClaims__OnTextCommand)) call TriggerAddCondition(dtrig,Condition(function libBaseClaims__OnDestroy)) set libBaseClaims__bctable=InitHashtable() set btrig=null set ctrig=null set dtrig=null endfunction function DecorateVamp takes unit u returns nothing call SetUnitVertexColor(u,32,0,0,224) call AddSpecialEffectTarget("Abilities\\Spells\\Other\\BreathOfFire\\BreathOfFireDamage.mdl",u,"origin") endfunction function libCinematic__TimedEvent takes real time,code func returns nothing local timer t=CreateTimer() call TimerStart(t,time,false,func) set t=null endfunction function libCinematic__RemoveVisibility takes nothing returns nothing local integer i=0 local integer k=0 loop exitwhen i>11 call RemoveUnit(libCinematic__visMod[i]) set i=i+1 endloop loop exitwhen k>11 if s__PlayerStruct_side[players[k]]==SIDE_VAMPIRE then call RemoveUnit(libCinematic__visMod[i]) endif set i=i+1 set k=k+1 endloop call DestroyTimer(GetExpiredTimer()) endfunction function ExplodePortal takes nothing returns nothing local integer i=0 call PauseTimer(libCinematic__channelTimerA) call DestroyTimer(libCinematic__channelTimerA) call PauseTimer(libCinematic__channelTimerB) call DestroyTimer(libCinematic__channelTimerB) loop exitwhen i>=10 call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl",GetUnitX(libCinematic__summoners[i]),GetUnitY(libCinematic__summoners[i]))) call DestroyLightning(libCinematic__summonLightning[i]) call KillUnit(libCinematic__summoners[i]) set i=i+1 endloop call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl",libCinematic__cx,libCinematic__cy)) call KillDestructable(libCinematic__portal) call StartSound(gg_snd_VampireBirth) call DisplayTextToPlayer(GetLocalPlayer(),0,0,"|cffFF0000The portal has been closed, but not before it unleashed a powerful evil upon this world.") call libCinematic__TimedEvent(5.,function libCinematic__RemoveVisibility) endfunction function libCinematic__OnChannelTimer takes nothing returns nothing local integer i=0 if GetExpiredTimer()==libCinematic__channelTimerB then set i=1 endif loop exitwhen i>=10 call SetUnitAnimation(libCinematic__summoners[i],"spell") set i=i+2 endloop endfunction function libCinematic__StartPortalChannel takes nothing returns nothing local integer i=1 local lightning l loop exitwhen i>=10 call SetUnitAnimation(libCinematic__summoners[i],"spell") set l=AddLightningEx("DRAB",true,libCinematic__cx,libCinematic__cy,150,GetUnitX(libCinematic__summoners[i]),GetUnitY(libCinematic__summoners[i]),50) set libCinematic__summonLightning[i]=l set i=i+2 endloop set l=null call TimerStart(libCinematic__channelTimerB,2.,true,function libCinematic__OnChannelTimer) call DestroyTimer(GetExpiredTimer()) endfunction function libCinematic__StartPortal takes nothing returns nothing set libCinematic__portal=CreateDestructable('OTsp',libCinematic__cx,libCinematic__cy,270,1.,0) call TimerStart(GetExpiredTimer(),4.,false,function libCinematic__StartPortalChannel) endfunction function libCinematic__StartPentagram takes nothing returns nothing local integer i=0 local integer j local lightning l loop exitwhen i>=10 set j=i+4 if j>=10 then set j=j-10 endif call SetUnitAnimation(libCinematic__summoners[i],"spell") set l=AddLightningEx("AFOD",true,GetUnitX(libCinematic__summoners[i]),GetUnitY(libCinematic__summoners[i]),50,GetUnitX(libCinematic__summoners[j]),GetUnitY(libCinematic__summoners[j]),50) set libCinematic__summonLightning[i]=l set i=i+2 endloop set l=null call TimerStart(libCinematic__channelTimerA,2.,true,function libCinematic__OnChannelTimer) call TimerStart(GetExpiredTimer(),2.,false,function libCinematic__StartPortal) endfunction function libCinematic__InitSummoners takes nothing returns nothing local integer i=0 local real r=384 local real x local real y local real a loop exitwhen i>=10 set a=bj_PI*i/5. set x=libCinematic__cx-r*Sin(a) set y=libCinematic__cy+r*Cos(a) set a=270+36*i set libCinematic__summoners[i]=CreateUnit(Player(15),'u005',x,y,a) set i=i+1 endloop call TimerStart(GetExpiredTimer(),2.,false,function libCinematic__StartPentagram) endfunction function libCinematic__InitVisibility takes nothing returns nothing local integer i=0 local integer k=0 loop exitwhen i>11 set libCinematic__visMod[i]=CreateUnit(Player(i),'oVis',libCinematic__cx,libCinematic__cy,0) set i=i+1 endloop loop exitwhen k>11 if s__PlayerStruct_side[players[k]]==SIDE_VAMPIRE then set libCinematic__visMod[i]=CreateUnit(Player(k),'vSel',-1280.0,128.0,0) endif set i=i+1 set k=k+1 endloop endfunction function InitTrig_libCinematic takes nothing returns nothing call libCinematic__InitVisibility() call PanCameraTo(GetRectCenterX(gg_rct_spawnHumans),GetRectCenterY(gg_rct_spawnHumans)) call libCinematic__TimedEvent(1.,function libCinematic__InitSummoners) endfunction function s__UnitData_create takes unit u returns integer local integer d=s__UnitData__allocate() return d endfunction function Data takes unit u returns integer return GetUnitUserData(u) endfunction function ReleaseUnit takes unit u returns nothing call ShowUnit(u,false) if IsUnitType(u,UNIT_TYPE_HERO)then if GetUnitUserData(u)!=0 then call s__UnitData_deallocate(GetUnitUserData(u)) call SetUnitUserData(u,0) endif else call KillUnit(u) endif call RemoveUnit(u) endfunction function AddDetection takes unit u returns nothing local integer d=GetUnitUserData(u) if s__UnitData_added[d]==false then set s__UnitData_added[d]=true call TriggerRegisterUnitEvent(dmgTrigger,u,EVENT_UNIT_DAMAGED) endif endfunction function libUnitSystem__OnDeath takes nothing returns boolean local unit u=GetDyingUnit() if not IsUnitType(u,UNIT_TYPE_HERO)and GetUnitUserData(u)!=0 then call s__UnitData_deallocate(GetUnitUserData(u)) call SetUnitUserData(u,0) endif set u=null return false endfunction function libUnitSystem__OnEnter takes nothing returns boolean local unit u=GetEnteringUnit() call SetUnitUserData(u,s__UnitData_create(u)) if IsUnitType(u,UNIT_TYPE_HERO)then call AddDetection(u) endif set u=null return false endfunction function libUnitSystem__GroupEnum takes nothing returns nothing local unit u=GetEnumUnit() call SetUnitUserData(u,s__UnitData_create(u)) if IsUnitType(u,UNIT_TYPE_HERO)then call AddDetection(u) endif set u=null endfunction function libUnitSystem__OnInit takes nothing returns nothing local trigger trg=XCreateTrigger() local group g=CreateGroup() local region rgn=CreateRegion() set dmgTrigger=XCreateTrigger() call GroupEnumUnitsInRect(g,bj_mapInitialPlayableArea,null) call ForGroup(g,function libUnitSystem__GroupEnum) call DestroyGroup(g) set g=null call RegionAddRect(rgn,bj_mapInitialPlayableArea) call TriggerRegisterEnterRegion(trg,rgn,null) call TriggerAddCondition(trg,Condition(function libUnitSystem__OnEnter)) set trg=XCreateTrigger() call TriggerRegisterAnyUnitEvent(trg,EVENT_PLAYER_UNIT_DEATH,null) call TriggerAddCondition(trg,Condition(function libUnitSystem__OnDeath)) set trg=null set rgn=null endfunction function ShowUnitMessage takes integer unitId returns boolean local integer id=GetUnitTypeId(GetTriggerUnit()) if id==unitId and LoadBoolean(messages__mht,id,0)==false then call SaveBoolean(messages__mht,id,0,true) return true endif return false endfunction function ShowMessage takes integer id returns boolean if LoadBoolean(messages__mht,id,0)==false then call SaveBoolean(messages__mht,id,0,true) return true endif return false endfunction function messages__OnBuild takes nothing returns boolean local unit u=GetTriggerUnit() local integer unitid=GetUnitTypeId(u) local integer p if ShowUnitMessage('h00G')then call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,5,"A Human has constructed the Citadel of Faith!") endif if ShowUnitMessage('h00E')then call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,5,"A Human has constructed a Ruby Wall!") endif if ShowUnitMessage('hCmd')then call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,5,"A Human has constructed the Command Center!") endif if ShowUnitMessage('h00N')then call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,5,"A Human has constructed the Base of Operations!") endif if ShowUnitMessage('h00A')then call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,5,"A Human has trained a level 3 harvester!") endif if unitid=='h00G' or unitid=='hCmd' or unitid=='h00N' then set p=GetPlayerId(GetOwningPlayer(u)) if uniqueUnit(p,unitid)==true then if unitid=='h00A' then call toHumans(5,GetPlayerNameColored(Player(p))+" has trained first "+GetUnitName(u)+" at "+TimeString(GameTime())) else call toHumans(5,GetPlayerNameColored(Player(p))+" has constructed a "+GetUnitName(u)+" at "+TimeString(GameTime())) endif endif endif return false endfunction function messages__ReplaceUnits takes integer old,integer new returns nothing local group g=CreateGroup() local unit u call GroupEnumUnitsOfType(g,UnitId2String(old),null) loop set u=FirstOfGroup(g) exitwhen u==null call GroupRemoveUnit(g,u) call ShowUnit(u,false) call CreateUnit(GetOwningPlayer(u),new,GetUnitX(u),GetUnitY(u),GetUnitFacing(u)) call RemoveUnit(u) endloop call DestroyGroup(g) set g=null endfunction function messages__OnTimer takes nothing returns boolean local integer side=s__PlayerStruct_side[(players[GetPlayerId((GetLocalPlayer()))])] if messages__messageNum==0 then elseif messages__messageNum==1 then call messages__ReplaceUnits('n00A','n00B') call StartSound(gg_snd_UndeadBuildingBirth3) call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10.,"|cffff0022"+I2S(timedStuff__curRealMinute)+" minutes have passed! Vampires may now combine advanced items in the Recipe Shop!|r") elseif messages__messageNum==2 then call ReplaceUnit(Demonic_Merchant,'n007') if side!=SIDE_HUMAN then call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10,"|cffff0022You can now purchase <Demonic Remains>|r") endif elseif messages__messageNum==3 then call ReplaceUnit(Demonic_Gate,'n005') call StartSound(gg_snd_HellOpens) call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10,"|cffff0022The Demonic Gate has opened...|r") endif set messages__messageNum=messages__messageNum+1 return false endfunction function InitTrig_messages takes nothing returns nothing local trigger trg=XCreateTrigger() call TriggerRegisterAnyUnitEvent(trg,EVENT_PLAYER_UNIT_UPGRADE_FINISH,null) call TriggerRegisterAnyUnitEvent(trg,EVENT_PLAYER_UNIT_CONSTRUCT_FINISH,null) call TriggerRegisterAnyUnitEvent(trg,EVENT_PLAYER_UNIT_TRAIN_FINISH,null) call TriggerAddCondition(trg,Condition(function messages__OnBuild)) endfunction function skins__RegisterSkin takes string name,integer skin,string publicKey,string modulo returns nothing set skins__skinName[skins__numSkins]=StringCase(name,false) set skins__skinUnit[skins__numSkins]=skin set skins__skinPublic[skins__numSkins]=publicKey set skins__skinModulo[skins__numSkins]=modulo set skins__skinCheat[skins__numSkins]=false set skins__numSkins=skins__numSkins+1 endfunction function skins__RegisterSkinCheat takes string name,integer skin returns nothing set skins__skinName[skins__numSkins]=StringCase(name,false) set skins__skinUnit[skins__numSkins]=skin set skins__skinPublic[skins__numSkins]="" set skins__skinModulo[skins__numSkins]="" set skins__skinCheat[skins__numSkins]=true set skins__numSkins=skins__numSkins+1 endfunction function GetPlayerSkin takes integer i returns integer if skins__skinId[i]>=0 then return skins__skinUnit[skins__skinId[i]] endif return'h010' endfunction function skins__FixUnitState takes nothing returns nothing local timer t=GetExpiredTimer() local unit a=(LoadUnitHandle(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH0))) local unit b=(LoadUnitHandle(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH1))) call SetUnitState(a,UNIT_STATE_LIFE,GetUnitState(b,UNIT_STATE_LIFE)) call SetUnitState(a,UNIT_STATE_MANA,GetUnitState(b,UNIT_STATE_MANA)) call RemoveUnit(b) call FlushChildHashtable(libHandleVars__ht,GetHandleId((t))) call DestroyTimer(t) set t=null set a=null set b=null endfunction function skins__OnChat takes nothing returns boolean local integer p=GetPlayerId(GetTriggerPlayer()) local string str=GetEventPlayerChatString() local unit oldUnit local boolean selected=false local timer t if SubString(str,0,1)=="#" and s__PlayerStruct_skin[players[p]]==SKIN_READY then set str=SubString(str,1,StringLength(str)) if(not skins__skinCheat[skins__skinId[p]])and(not SetNumString(num_data,str))then call DisplayTimedTextToPlayer(Player(p),0,0,10,"|cffff0404Invalid code!|r") set s__PlayerStruct_skin[players[p]]=SKIN_FAILED return false endif if not skins__skinCheat[skins__skinId[p]]then call SetNumString(num_mod,skins__skinModulo[skins__skinId[p]]) call SetNumString(num_pub,skins__skinPublic[skins__skinId[p]]) call PowNumMod(num_res,num_data,num_pub,num_mod) call SetNumString(num_code,gameCode) endif if skins__skinCheat[skins__skinId[p]]or NumEqual(num_res,num_code)then call DisplayTimedTextToPlayer(Player(p),0,0,10,"|cff20c000Login successful!|r") set s__PlayerStruct_skin[players[p]]=SKIN_OK if s__PlayerStruct_side[players[p]]==SIDE_HUMAN and s__PlayerStruct_main[players[p]]!=null then set oldUnit=s__PlayerStruct_main[players[p]] set selected=IsUnitSelected(oldUnit,Player(p)) if GetLocalPlayer()==Player(p)and selected then call SelectUnit(oldUnit,false) endif call ShowUnit(oldUnit,false) set s__PlayerStruct_main[players[p]]=CreateUnit(Player(p),skins__skinUnit[skins__skinId[p]],GetUnitX(oldUnit),GetUnitY(oldUnit),GetUnitFacing(oldUnit)) if GetLocalPlayer()==Player(p)and selected then call SelectUnit(s__PlayerStruct_main[players[p]],true) endif set t=CreateTimer() call SaveUnitHandle(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH0),(s__PlayerStruct_main[players[p]])) call SaveUnitHandle(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH1),(oldUnit)) call TimerStart(t,.0,false,function skins__FixUnitState) set t=null set oldUnit=null endif else call DisplayTimedTextToPlayer(Player(p),0,0,10,"|cffff0404Login failed!|r") set s__PlayerStruct_skin[players[p]]=SKIN_FAILED endif endif return false endfunction function skins__OnEsc takes nothing returns boolean local integer p=GetPlayerId(GetTriggerPlayer()) if s__PlayerStruct_skin[players[p]]==SKIN_ALLOW then set s__PlayerStruct_skin[players[p]]=SKIN_READY call TriggerRegisterPlayerChatEvent(skins__trgChat,Player(p),"#",false) call UnitAddAbility(skins__boxes[p],'A01E') call UnitAddAbility(skins__boxes[p],'A01T') endif return false endfunction function skins__OnInit takes nothing returns nothing local integer i=0 local integer j local trigger trgEsc=XCreateTrigger() set skins__trgChat=XCreateTrigger() set gameCode=RandomKey() call skins__RegisterSkin("aahat",'h017',"","") call skins__RegisterSkin("moshiloshi",'h01K',"","") call skins__RegisterSkin("holycrap11",'h00Y',"","") call skins__RegisterSkin("xxxbmxxxx",'h01O',"","") call skins__RegisterSkin("xxxbmxxxxx",'h01O',"","") call skins__RegisterSkin("zo.omvf",'h01M',"","") call skins__RegisterSkin("heavenzo.om",'h01M',"","") call skins__RegisterSkin("dark.error",'h01F',"","") call skins__RegisterSkin("[maddoxx]",'h01D',"","") call skins__RegisterSkin("maddoxx",'h01D',"","") call skins__RegisterSkin("lang_br",'h01A',"","") call skins__RegisterSkin("dusteR^",'h01T',"","") call skins__RegisterSkin("quji",'h01Y',"","") call skins__RegisterSkin("lumicko",'h01Q',"","") call skins__RegisterSkin("hassoon",'h01Z',"","") call skins__RegisterSkin("oracle.man",'h016',"","") call skins__RegisterSkin("dantesrevenge",'h00X',"","") call skins__RegisterSkin("dantesavenger",'h00X',"","") call skins__RegisterSkin("ph3n0m3n0n",'h01J',"","") call skins__RegisterSkin("satanicredevil",'h018',"","") call skins__RegisterSkin("iamlycanthrope",'h01N',"","") call skins__RegisterSkin("The.Big.Fish",'h01W',"","") call skins__RegisterSkin("I.Win",'h01W',"","") call skins__RegisterSkin("deja_",'h01I',"","") call skins__RegisterSkin("erotomaniac",'h01P',"","") call skins__RegisterSkin("myexgf",'h014',"","") call skins__RegisterSkin("n04n3n1k",'h01B',"","") call skins__RegisterSkin("n1pro.run",'h00W',"","") call skins__RegisterSkin("fnk42",'h01H',"","") call skins__RegisterSkin("[VPS]Kawl1nsH",'h01G',"","") call skins__RegisterSkin("kawlinsh",'h01G',"","") loop exitwhen i>11 set skins__skinId[i]=-1 set skins__boxes[i]=null set j=0 loop exitwhen j>=skins__numSkins if StringCase(s__PlayerStruct_name[players[i]],false)==skins__skinName[j]then set s__PlayerStruct_skin[players[i]]=SKIN_ALLOW set skins__skinId[i]=j set j=skins__numSkins endif set j=j+1 endloop set i=i+1 endloop endfunction function s__Tip_onTimer takes nothing returns nothing local timer t=GetExpiredTimer() local integer tip=LoadInteger(s__Tip_hash,GetHandleId(t),0) local player p=GetLocalPlayer() if s__Tip_level[tip]<=tips__plTipLevel[GetPlayerId(p)]then if s__Tip_target[tip]==p or tips__maskMatch[s__Tip_mask[tip]*4+s__PlayerStruct_side[(players[GetPlayerId((p))])]]!=0 then call StartSound(tips__tipSound) call DisplayTextToPlayer(p,0,0,"Tip: |c006699cc"+s__Tip_text[tip]+"|r") if s__Tip_pingMap[tip]then call PingMinimapEx(s__Tip_pingX[tip],s__Tip_pingY[tip],5,255,255,255,true) endif endif endif call FlushChildHashtable(s__Tip_hash,GetHandleId(t)) call PauseTimer(t) call DestroyTimer(t) set s__Tip_t[tip]=null set t=null call s__Tip_deallocate(tip) endfunction function s__Tip_create takes integer mask,integer level,real time,string text returns integer local integer tip=s__Tip__allocate() set s__Tip_t[tip]=CreateTimer() set s__Tip_mask[tip]=mask set s__Tip_level[tip]=level set s__Tip_text[tip]=text set s__Tip_target[tip]=null set s__Tip_pingMap[tip]=false call SaveInteger(s__Tip_hash,GetHandleId(s__Tip_t[tip]),0,tip) call TimerStart(s__Tip_t[tip],time,false,function s__Tip_onTimer) return tip endfunction function s__Tip_for takes player to,real time,string text returns integer local integer tip=s__Tip_create(0,1,time,text) set s__Tip_target[tip]=to return tip endfunction function s__Tip_humans takes real time,string text returns integer return s__Tip_create(tips__HUMANTIP,1,time,text) endfunction function s__Tip_vampires takes real time,string text returns integer return s__Tip_create(tips__VAMPIRETIP+tips__MINIONTIP,1,time,text) endfunction function s__Tip_all takes real time,string text returns integer return s__Tip_create(tips__HUMANTIP+tips__VAMPIRETIP+tips__MINIONTIP,1,time,text) endfunction function s__Tip_forUber takes player to,real time,string text returns integer local integer tip=s__Tip_create(0,0,time,text) set s__Tip_target[tip]=to return tip endfunction function s__Tip_humansUber takes real time,string text returns integer return s__Tip_create(tips__HUMANTIP,0,time,text) endfunction function s__Tip_vampiresUber takes real time,string text returns integer return s__Tip_create(tips__VAMPIRETIP+tips__MINIONTIP,0,time,text) endfunction function s__Tip_allUber takes real time,string text returns integer return s__Tip_create(tips__HUMANTIP+tips__VAMPIRETIP+tips__MINIONTIP,0,time,text) endfunction function s__Tip_ping takes integer this,real x,real y returns nothing set s__Tip_pingMap[this]=true set s__Tip_pingX[this]=x set s__Tip_pingY[this]=y endfunction function tips__initMaskMatch takes integer mask,integer a,integer b,integer c returns nothing set tips__maskMatch[mask*4+0]=0 set tips__maskMatch[mask*4+1]=a set tips__maskMatch[mask*4+2]=b set tips__maskMatch[mask*4+3]=c endfunction function MiniVampTips takes player p returns nothing call s__Tip_forUber(p,5.,"You have been reborn as a vampire. Do not panic, you can prove useful in the great schemes of the Ancient Vampires.") call s__Tip_for(p,10.,"In addition to regular vampire abilities you have a powerful aura that empowers nearby vampires.") call s__Tip_for(p,20.,"Find human bases by using Shadow Sight as often as possible and help other vampires destroy them.") call s__Tip_for(p,30.,"Whenever you kill a unit or destroy a structure it might drop coins that you have to pick up before Slayers can steal them.") endfunction function tips__OnTips takes nothing returns boolean local integer p=GetPlayerId(GetTriggerPlayer()) if tips__plTipLevel[p]==0 then call DisplayTextToPlayer(Player(p),0,0,"|cff6699ccTips have been enabled|r") endif set tips__plTipLevel[p]=1 return false endfunction function InitTrig_tips takes nothing returns nothing local trigger trg=XCreateTrigger() local integer i=0 call tips__initMaskMatch(0,0,0,0) call tips__initMaskMatch(1,1,0,0) call tips__initMaskMatch(2,0,1,0) call tips__initMaskMatch(3,1,1,0) call tips__initMaskMatch(4,0,0,1) call tips__initMaskMatch(5,1,0,1) call tips__initMaskMatch(6,0,1,1) call tips__initMaskMatch(7,1,1,1) set tips__tipSound=CreateSound("Sound\\Interface\\SecretFound.wav",false,false,false,10,10,"") call SetSoundParamsFromLabel(tips__tipSound,"SecretFound") call SetSoundDuration(tips__tipSound,2525) loop exitwhen i>11 set tips__plTipLevel[i]=0 call TriggerRegisterPlayerChatEvent(trg,Player(i),"-tips",true) set i=i+1 endloop call TriggerAddCondition(trg,Condition(function tips__OnTips)) call s__Tip_create(tips__HUMANTIP+tips__VAMPIRETIP+tips__MINIONTIP,0,((2.)*1.),("|cffffcc00Type -tips to enable tips|r")) call s__Tip_create(tips__HUMANTIP,0,((1.)*1.),("Run! Run! Run! The Vampires are arriving any minute now, we barely have time to hide!")) call s__Tip_create(tips__HUMANTIP,0,((5.)*1.),("Use Blink (Hotkey N or K) to get around the map faster.")) call s__Tip_create(tips__HUMANTIP,1,((15.)*1.),("Try to find yourself a base with one exit so it will be easier to defend against vampires.")) call s__Tip_create(tips__HUMANTIP,1,((45.)*1.),("Make sure you recruit as many workers as possible to harvest lumber faster.")) call s__Tip_create(tips__HUMANTIP,1,((60.)*1.),("Build a flag in your base to claim it. Type -allow <color> to allow another player to build inside your base.")) call s__Tip_create(tips__HUMANTIP,1,((75.)*1.),("Build a Slayer's Tavern when you have enough lumber and start summoning your slayer.")) call s__Tip_create(tips__HUMANTIP,1,((150.)*1.),("If your base has a wide entrance that you can fit two walls into, you can most likely build one wall in the center and the vampire will not be able to get in.")) call s__Tip_create(tips__HUMANTIP,1,((120.)*1.),("If a Vampire finds your base and breaks through your defenses, don't panic! Detonate your workers by selecting them and then pressing D and clicking mutiple times - this way the Vampire will have less to feed on.")) call s__Tip_ping((s__Tip_create(tips__HUMANTIP,1,((180.)*1.),("Once you have summoned your slayer, move him/her to the Slayer's Pool to gain levels: every minute all Slayers in the pool are awarded one level."))),4000,3500) call s__Tip_create(tips__HUMANTIP,1,((210.)*1.),("If you see a Vampire destroying someone's base, watch out for coins that drop from destroyed buildings and killed units and be ready to blink in with your Slayer and steal the coins.")) call s__Tip_create(tips__HUMANTIP,1,((240.)*1.),("Sometimes Vampires will try to build Massive Graves near your base. Once built, they will deal a lot of damage to your workers and you will not have time to detonate them unless you have researched Improved Worker Motivation.")) call s__Tip_create(tips__HUMANTIP,1,((300.)*1.),("Try to save up as much lumber until you get some gold, because then you can greatly improve your wall and start upgrading your base.")) call s__Tip_create(tips__HUMANTIP,1,((360.)*1.),("Leave some space behind your wall so several Humans can help repair the wall against Vampires.")) call s__Tip_create(tips__HUMANTIP,1,((420.)*1.),("The vampires can recruit small invisible shades which can sneak past your wall and hide inside your base if you leave gaps between your towers. The vampire can later teleport to those shades and destroy your base from inside.")) call s__Tip_create(tips__HUMANTIP,1,((910.)*1.),("Now that you've got some gold, build a Slayer's Vault and upgrade your wall to Sapphire or even Emerald. Save lumber and build Gold Mines to get additional gold.")) call s__Tip_create(tips__HUMANTIP,1,((1000.)*1.),("Later on the Vampires can don't click me a Sphere of Doom which will allow them to jump a very short distance, so build simple walls along the edge of your base where there are no trees.")) call s__Tip_create(tips__HUMANTIP,1,((1200.)*1.),("When you get Furbolg Harvesters, have them build Wall Towers in place of those extra walls or towers you made to protect against shades or Sphere of Doom.")) call s__Tip_create(tips__VAMPIRETIP+tips__MINIONTIP,0,((5.)*1.),("You are about to enter the world of mortals, your goal is to destroy all humans and convert them to your bidding.")) call s__Tip_create(tips__VAMPIRETIP+tips__MINIONTIP,1,((15.)*1.),("Once you get control of your Vampire, it is recommended that you skill up Veil of Shadows and Shadow Sight, they will allow you to find human bases faster and escape death in case humans are prepared for your visit.")) call s__Tip_create(tips__VAMPIRETIP+tips__MINIONTIP,1,((30.)*1.),("Whenever you kill a Human, he will be reborn as your Minion. Type -nomini if you do not wish to have Minions.")) call s__Tip_create(tips__VAMPIRETIP+tips__MINIONTIP,1,((45.)*1.),("Whenever you kill a unit or destroy a structure it might drop coins that you have to pick up before Slayers can steal them.")) call s__Tip_create(tips__VAMPIRETIP+tips__MINIONTIP,1,((90.)*1.),("Be very careful and do not get trapped in by walls, workers, or slayers. If you find yourself in such a situation, try to use Veil of Shadows and run away if it not too late.")) call s__Tip_create(tips__VAMPIRETIP+tips__MINIONTIP,1,((120.)*1.),("For 30 gold you can don't click me Massive Graves that let you build a structure that kills workers in 1000 range to get lots of gold and experience. Make sure humans do not see you building them or they can detonate their workers before its finished.")) call s__Tip_create(tips__VAMPIRETIP+tips__MINIONTIP,1,((180.)*1.),("Never use Chain of Death on workers if you cannot pick the gold that may drop from the workers.")) endfunction function playerLeaves__FinishRemove takes nothing returns nothing local timer t=GetExpiredTimer() local integer p=(LoadInteger(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH0))) local group g=CreateGroup() local unit u call GroupEnumUnitsOfPlayer(g,Player(p),null) loop set u=FirstOfGroup(g) exitwhen u==null call GroupRemoveUnit(g,u) call ExplodeUnit(u) endloop call DestroyGroup(g) call FlushChildHashtable(libHandleVars__ht,GetHandleId((t))) call PauseTimer(t) call DestroyTimer(t) set t=null set g=null endfunction function OnPlayerLeft takes integer p returns nothing local group g=CreateGroup() local timer t local unit u local string gender call GroupEnumUnitsOfPlayer(g,Player(p),null) if(libBase__bigGameTime+TimerGetElapsed(libBase__bigGameTimer))-s__PlayerStruct_noLeaveTimer[players[p]]<30 then call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10.,GetPlayerNameColored(Player(p))+"|cffffcc00's base was being destroyed, "+GetGenderHis(Player(p))+" structures and workers will remain in the game for one minute.|r") loop set u=FirstOfGroup(g) exitwhen u==null call GroupRemoveUnit(g,u) if not(IsUnitType(u,UNIT_TYPE_STRUCTURE)or IsHarvester(u))then call ExplodeUnit(u) endif endloop set t=CreateTimer() call SaveInteger(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH0),(p)) call TimerStart(t,60.,false,function playerLeaves__FinishRemove) set t=null else loop set u=FirstOfGroup(g) exitwhen u==null call GroupRemoveUnit(g,u) call ExplodeUnit(u) endloop endif call DestroyGroup(g) set g=null endfunction function playerLeaves__OnLeave takes nothing returns boolean local group g=null local unit u local integer i local integer p=GetPlayerId(GetTriggerPlayer()) if s__PlayerStruct_side[players[p]]==SIDE_HUMAN then call PlayerUnclaim(Player(p)) call ShareGold(p) if s__PlayerStruct_state[players[p]]==STATE_PLAYING then set s__PlayerStruct_state[players[p]]=STATE_LEFT call SetPlayerName(Player(p),s__PlayerStruct_name[players[p]]+" (Left)") call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10.,GetPlayerNameColored(Player(p))+" has left the game") call OnPlayerLeft(p) elseif s__PlayerStruct_state[players[p]]==STATE_DEAD then set s__PlayerStruct_state[players[p]]=STATE_LEFT call SetPlayerName(Player(p),s__PlayerStruct_name[players[p]]+" (Dead & Left)") call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10.,GetPlayerNameColored(Player(p))+" (Dead) has left the game") endif else if s__PlayerStruct_state[players[p]]==STATE_PLAYING then set s__PlayerStruct_state[players[p]]=STATE_LEFT call ShareGold(p) call ShareVampItems(p) set g=CreateGroup() call GroupEnumUnitsOfPlayer(g,Player(p),null) loop set u=FirstOfGroup(g) exitwhen u==null call GroupRemoveUnit(g,u) if GetUnitTypeId(u)!='n003' then call RemoveUnit(u) endif endloop call DestroyGroup(g) call SetPlayerName(Player(p),s__PlayerStruct_name[players[p]]+" (Left)") call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10.,GetPlayerNameColored(Player(p))+" has left the game") elseif s__PlayerStruct_state[players[p]]==STATE_DEAD then set s__PlayerStruct_state[players[p]]=STATE_LEFT call SetPlayerName(Player(p),s__PlayerStruct_name[players[p]]+" (Dead & Left)") call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10.,GetPlayerNameColored(Player(p))+" (Dead) has left the game") endif endif call UpdateAmounts(true) call UpdateMultiboard() set g=null set u=null return false endfunction function InitTrig_playerLeaves takes nothing returns nothing local trigger trg=XCreateTrigger() local integer i=0 loop exitwhen i>11 call TriggerRegisterPlayerEvent(trg,Player(i),EVENT_PLAYER_LEAVE) set i=i+1 endloop call TriggerAddCondition(trg,Condition(function playerLeaves__OnLeave)) set trg=null endfunction function slayerMove__SpotEnum takes nothing returns nothing local unit u=GetEnumUnit() local unit u2 local real dist local boolean ok=true call GroupEnumUnitsInRange(slayerMove__g2,GetUnitX(u),GetUnitY(u),128,null) loop set u2=FirstOfGroup(slayerMove__g2) exitwhen u2==null call GroupRemoveUnit(slayerMove__g2,u2) if u2!=slayerMove__g_slayer and(GetUnitX(u)-GetUnitX(u2))*(GetUnitX(u)-GetUnitX(u2))+(GetUnitY(u)-GetUnitY(u2))*(GetUnitY(u)-GetUnitY(u2))<64*64 then set ok=false endif endloop if ok then set dist=(GetUnitX(u)-GetUnitX(slayerMove__g_slayer))*(GetUnitX(u)-GetUnitX(slayerMove__g_slayer))+(GetUnitY(u)-GetUnitY(slayerMove__g_slayer))*(GetUnitY(u)-GetUnitY(slayerMove__g_slayer)) if slayerMove__g_best==null or dist<slayerMove__g_dist then set slayerMove__g_best=u set slayerMove__g_dist=dist endif endif set u=null endfunction function MoveSlayerInPool takes unit slayer returns nothing if GetUnitX(slayer)>GetRectMinX(gg_rct_SlayerPool)and GetUnitX(slayer)<GetRectMaxX(gg_rct_SlayerPool)and GetUnitY(slayer)>GetRectMinY(gg_rct_SlayerPool)and GetUnitY(slayer)<GetRectMaxY(gg_rct_SlayerPool)then set slayerMove__g2=CreateGroup() set slayerMove__g_slayer=slayer set slayerMove__g_best=null set slayerMove__g_dist=0 call ForGroup(slayerMove__slayerSpots,function slayerMove__SpotEnum) call DestroyGroup(slayerMove__g2) if slayerMove__g_best!=null then call DisableTrigger(slayerMove__slayerTrigger) call IssuePointOrderById(slayer,851986,GetUnitX(slayerMove__g_best),GetUnitY(slayerMove__g_best)) call EnableTrigger(slayerMove__slayerTrigger) if s__UnitData_orderTimer[(GetUnitUserData((slayer)))]!=null then call PauseTimer(s__UnitData_orderTimer[(GetUnitUserData((slayer)))]) endif endif endif endfunction function slayerMove__OnOrderTimer takes nothing returns nothing local timer t=GetExpiredTimer() call MoveSlayerInPool((LoadUnitHandle(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH0)))) set t=null endfunction function slayerMove__OnOrder takes nothing returns boolean local unit u=GetOrderedUnit() local integer ud=(GetUnitUserData((u))) if s__UnitData_orderTimer[ud]==null then set s__UnitData_orderTimer[ud]=CreateTimer() call SaveUnitHandle(libHandleVars__ht,GetHandleId((s__UnitData_orderTimer[ud])),(HASH_ATTACH0),(u)) endif call TimerStart(s__UnitData_orderTimer[ud],5.,true,function slayerMove__OnOrderTimer) set u=null return false endfunction function slayerMove__AddLocust takes nothing returns nothing call UnitAddAbility(GetEnumUnit(),'Aloc') endfunction function InitTrig_slayerMove takes nothing returns nothing set slayerMove__slayerTrigger=XCreateTrigger() call TriggerRegisterAnyUnitEvent(slayerMove__slayerTrigger,EVENT_PLAYER_UNIT_ISSUED_ORDER,null) call TriggerRegisterAnyUnitEvent(slayerMove__slayerTrigger,EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER,null) call TriggerRegisterAnyUnitEvent(slayerMove__slayerTrigger,EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER,null) call TriggerAddCondition(slayerMove__slayerTrigger,Condition(function slayerMove__OnOrder)) call GroupEnumUnitsOfType(slayerMove__slayerSpots,UnitId2String('h01X'),null) call ForGroup(slayerMove__slayerSpots,function slayerMove__AddLocust) endfunction function InitGlobals takes nothing returns nothing local integer i=0 loop exitwhen i>11 set leakChances[i]=100 set leakPlayerCheckers[i]=CreateForce() set i=i+1 endloop endfunction function InitSounds takes nothing returns nothing set gg_snd_rock=CreateSound("Sound\\Music\\mp3Music\\PH1.mp3",false,false,false,10,10,"DefaultEAXON") call SetSoundParamsFromLabel(gg_snd_rock,"PHMusic") call SetSoundDuration(gg_snd_rock,281582) call SetSoundVolume(gg_snd_rock,127) set gg_snd_Credits=CreateSound("Sound\\Music\\mp3Music\\Credits.mp3",false,false,false,10,10,"DefaultEAXON") call SetSoundParamsFromLabel(gg_snd_Credits,"CreditsMusic") call SetSoundDuration(gg_snd_Credits,83017) set gg_snd_HPitLordWhat1=CreateSound("Units\\Demon\\HeroPitLord\\HPitLordWhat1.wav",false,false,true,10,10,"HeroAcksEAX") call SetSoundParamsFromLabel(gg_snd_HPitLordWhat1,"HeroPitLordWhat") call SetSoundDuration(gg_snd_HPitLordWhat1,2711) set gg_snd_HPitLordYes1=CreateSound("Units\\Demon\\HeroPitLord\\HPitLordYes1.wav",false,false,true,10,10,"HeroAcksEAX") call SetSoundParamsFromLabel(gg_snd_HPitLordYes1,"HeroPitLordYes") call SetSoundDuration(gg_snd_HPitLordYes1,2049) set gg_snd_HPitLordYesAttack1=CreateSound("Units\\Demon\\HeroPitLord\\HPitLordYesAttack1.wav",false,false,true,10,10,"HeroAcksEAX") call SetSoundParamsFromLabel(gg_snd_HPitLordYesAttack1,"HeroPitLordYesAttack") call SetSoundDuration(gg_snd_HPitLordYesAttack1,1908) set gg_snd_LightningBolt1=CreateSound("Doodads\\Cinematic\\Lightningbolt\\LightningBolt1.wav",false,false,true,10,10,"SpellsEAX") call SetSoundParamsFromLabel(gg_snd_LightningBolt1,"CinematicLightningBolt") call SetSoundDuration(gg_snd_LightningBolt1,3001) set gg_snd_Birth=CreateSound("Units\\Orc\\StasisTotem\\StasisTrapBirth.wav",false,true,true,10,10,"SpellsEAX") call SetSoundParamsFromLabel(gg_snd_Birth,"StasisTotemBirth") call SetSoundDuration(gg_snd_Birth,2345) set gg_snd_Death=CreateSound("Units\\Orc\\StasisTotem\\StasisTotem.wav",false,true,true,10,10,"SpellsEAX") call SetSoundParamsFromLabel(gg_snd_Death,"StasisTotemDeath") call SetSoundDuration(gg_snd_Death,1858) set gg_snd_Sphere1=CreateSound("Buildings\\Undead\\Ziggurat\\FrostTowerWhat1.wav",false,false,true,10,10,"DefaultEAXON") call SetSoundParamsFromLabel(gg_snd_Sphere1,"FrostTowerWhat") call SetSoundDuration(gg_snd_Sphere1,4203) call SetSoundChannel(gg_snd_Sphere1,7) call SetSoundVolume(gg_snd_Sphere1,127) call SetSoundPitch(gg_snd_Sphere1,.1) set gg_snd_Sphere2=CreateSound("Buildings\\Undead\\Ziggurat\\ZigguratUpgrade.wav",false,false,true,10,10,"DefaultEAXON") call SetSoundParamsFromLabel(gg_snd_Sphere2,"ZigguratUpgradeWhat") call SetSoundDuration(gg_snd_Sphere2,4203) call SetSoundChannel(gg_snd_Sphere2,7) call SetSoundVolume(gg_snd_Sphere2,127) call SetSoundPitch(gg_snd_Sphere2,.1) set gg_snd_Sphere3=CreateSound("Buildings\\Undead\\Ziggurat\\ZigguratWhat.wav",false,false,true,10,10,"DefaultEAXON") call SetSoundParamsFromLabel(gg_snd_Sphere3,"ZigguratWhat") call SetSoundDuration(gg_snd_Sphere3,4457) call SetSoundChannel(gg_snd_Sphere3,7) call SetSoundVolume(gg_snd_Sphere3,127) call SetSoundPitch(gg_snd_Sphere3,.1) set gg_snd_HellOpens=CreateSound("Units\\Undead\\ObsidianStatue\\ObsidianAvengerPissed1.wav",false,true,true,10,10,"DefaultEAXON") call SetSoundParamsFromLabel(gg_snd_HellOpens,"ObsidianDestroyerPissed") call SetSoundDuration(gg_snd_HellOpens,3024) call SetSoundPitch(gg_snd_HellOpens,.8) set gg_snd_VampireBirth=CreateSound("Units\\Undead\\Varimathras\\VarimathrasReady1.wav",false,false,false,10,10,"HeroAcksEAX") call SetSoundParamsFromLabel(gg_snd_VampireBirth,"VarimathrasReady") call SetSoundDuration(gg_snd_VampireBirth,2122) call SetSoundPitch(gg_snd_VampireBirth,1.1) set gg_snd_UndeadBuildingBirth3=CreateSound("Sound\\Buildings\\Undead\\UndeadBuildingBirth3.wav",false,false,true,10,10,"DefaultEAXON") call SetSoundParamsFromLabel(gg_snd_UndeadBuildingBirth3,"UndeadBuildingBirth3") call SetSoundDuration(gg_snd_UndeadBuildingBirth3,4087) set gg_snd_Doom=CreateSound("Sound\\Music\\mp3Music\\Doom.mp3",false,false,false,10,10,"") call SetSoundDuration(gg_snd_Doom,66125) call SetSoundChannel(gg_snd_Doom,0) call SetSoundVolume(gg_snd_Doom,127) call SetSoundPitch(gg_snd_Doom,1.) set gg_snd_GromPissed3=CreateSound("Units\\Orc\\Hellscream\\GromPissed3.wav",false,false,true,10,10,"HeroAcksEAX") call SetSoundParamsFromLabel(gg_snd_GromPissed3,"GromPissed") call SetSoundDuration(gg_snd_GromPissed3,5503) set gg_snd_Gas=CreateSound("Units\\Orc\\SpiritWalker\\WhiteTaurenPissed6.wav",false,false,true,10,10,"DefaultEAXON") call SetSoundParamsFromLabel(gg_snd_Gas,"SpiritWalkerPissed") call SetSoundDuration(gg_snd_Gas,13904) set gg_snd_Jamming=CreateSound("Units\\Other\\Rokhan\\RokhanPissed5.wav",false,false,true,10,10,"HeroAcksEAX") call SetSoundParamsFromLabel(gg_snd_Jamming,"RokhanPissed") call SetSoundDuration(gg_snd_Jamming,7210) set gg_snd_MyHoodsDown=CreateSound("Units\\Undead\\Acolyte\\AcolytePissed3.wav",false,false,true,10,10,"HeroAcksEAX") call SetSoundParamsFromLabel(gg_snd_MyHoodsDown,"AcolytePissed") call SetSoundDuration(gg_snd_MyHoodsDown,3715) set gg_snd_EndSoundForVamps=CreateSound("Units\\Undead\\Acolyte\\AcolytePissed2.wav",false,false,true,10,10,"HeroAcksEAX") call SetSoundParamsFromLabel(gg_snd_EndSoundForVamps,"AcolytePissed") call SetSoundDuration(gg_snd_EndSoundForVamps,2566) set gg_snd_DontClickMe=CreateSound("Units\\Undead\\HeroDeathKnight\\DeathKnightPissed6.wav",false,false,true,10,10,"HeroAcksEAX") call SetSoundParamsFromLabel(gg_snd_DontClickMe,"HeroDeathKnightPissed") call SetSoundDuration(gg_snd_DontClickMe,3385) set gg_snd_IseeUndeadPeople=CreateSound("Units\\Undead\\Necromancer\\NecromancerPissed3.wav",false,false,true,10,10,"DefaultEAXON") call SetSoundParamsFromLabel(gg_snd_IseeUndeadPeople,"NecromancerPissed") call SetSoundDuration(gg_snd_IseeUndeadPeople,2154) set gg_snd_DemonstrationLOL=CreateSound("Units\\Undead\\Varimathras\\VarimathrasPissed8.wav",false,false,true,10,10,"HeroAcksEAX") call SetSoundParamsFromLabel(gg_snd_DemonstrationLOL,"VarimathrasPissed") call SetSoundDuration(gg_snd_DemonstrationLOL,8906) set gg_snd_PitlordTalkshow=CreateSound("Units\\Demon\\HeroPitLord\\HPitLordPissed5.wav",false,false,true,10,10,"HeroAcksEAX") call SetSoundParamsFromLabel(gg_snd_PitlordTalkshow,"HeroPitLordPissed") call SetSoundDuration(gg_snd_PitlordTalkshow,43503) set gg_snd_DropTheVilliger=CreateSound("Units\\Human\\BloodElfDragonHawk\\DragonHawkPissed8.wav",false,false,true,10,10,"HeroAcksEAX") call SetSoundParamsFromLabel(gg_snd_DropTheVilliger,"BloodElfDragonHawkPissed") call SetSoundDuration(gg_snd_DropTheVilliger,10077) set gg_snd_MyFavourateColor=CreateSound("Units\\Human\\Knight\\KnightPissed1.wav",false,false,true,10,10,"DefaultEAXON") call SetSoundParamsFromLabel(gg_snd_MyFavourateColor,"KnightPissed") call SetSoundDuration(gg_snd_MyFavourateColor,3670) set gg_snd_Knee=CreateSound("Units\\Human\\Knight\\KnightPissed5.wav",false,false,true,10,10,"DefaultEAXON") call SetSoundParamsFromLabel(gg_snd_Knee,"KnightPissed") call SetSoundDuration(gg_snd_Knee,2229) set gg_snd_BurninLootinBombinShootin=CreateSound("Units\\Human\\MortarTeam\\MortarTeamPissed8.wav",false,false,true,10,10,"DefaultEAXON") call SetSoundParamsFromLabel(gg_snd_BurninLootinBombinShootin,"MortarTeamPissed") call SetSoundDuration(gg_snd_BurninLootinBombinShootin,3802) set gg_snd_WelliDidntVoteForYou=CreateSound("Units\\Human\\Peasant\\PeasantPissed1.wav",false,false,true,10,10,"DefaultEAXON") call SetSoundParamsFromLabel(gg_snd_WelliDidntVoteForYou,"PeasantPissed") call SetSoundDuration(gg_snd_WelliDidntVoteForYou,3437) set gg_snd_MagicIsNotForEveryone=CreateSound("Units\\Human\\Priest\\PriestPissed6.wav",false,false,true,10,10,"DefaultEAXON") call SetSoundParamsFromLabel(gg_snd_MagicIsNotForEveryone,"PriestPissed") call SetSoundDuration(gg_snd_MagicIsNotForEveryone,9323) set gg_snd_GunsDontKillPeople=CreateSound("Units\\Human\\Rifleman\\RiflemanPissed5.wav",false,false,true,10,10,"DefaultEAXON") call SetSoundParamsFromLabel(gg_snd_GunsDontKillPeople,"RiflemanPissed") call SetSoundDuration(gg_snd_GunsDontKillPeople,4168) set gg_snd_WeFoundAWitch=CreateSound("Units\\Human\\Peasant\\PeasantPissed2.wav",false,false,true,10,10,"DefaultEAXON") call SetSoundParamsFromLabel(gg_snd_WeFoundAWitch,"PeasantPissed") call SetSoundDuration(gg_snd_WeFoundAWitch,2699) set gg_snd_FrostwyrmReady1=CreateSound("Units\\Undead\\FrostWyrm\\FrostwyrmReady1.wav",false,false,true,10,10,"DefaultEAXON") call SetSoundParamsFromLabel(gg_snd_FrostwyrmReady1,"FrostWyrmReady") call SetSoundDuration(gg_snd_FrostwyrmReady1,4017) call SetSoundChannel(gg_snd_FrostwyrmReady1,8) set gg_snd_ReceiveGold=CreateSound("Abilities\\Spells\\Items\\ResourceItems\\ReceiveGold.wav",false,false,true,10,10,"SpellsEAX") call SetSoundParamsFromLabel(gg_snd_ReceiveGold,"ReceiveGold") call SetSoundDuration(gg_snd_ReceiveGold,589) set gg_snd_bfbp=CreateSound("war3mapImported\\bfbp.mp3",false,false,false,10,10,"") call SetSoundDuration(gg_snd_bfbp,3918) call SetSoundChannel(gg_snd_bfbp,0) call SetSoundVolume(gg_snd_bfbp,127) call SetSoundPitch(gg_snd_bfbp,1.) endfunction function CreateNeutralPassiveBuildings takes nothing returns nothing local player p=Player(15) local unit u local integer unitID local trigger t set u=CreateUnit(p,'n000',-256.0,512.0,270.000) set u=CreateUnit(p,'n00S',320.0,448.0,270.000) set u=CreateUnit(p,'n00E',0.0,512.0,270.000) set u=CreateUnit(p,'n00I',-512.0,512.0,270.000) set u=CreateUnit(p,'n002',192.0,448.0,270.000) set u=CreateUnit(p,'vPt1',-1280.0,128.0,270.000) call SetUnitColor(u,ConvertPlayerColor(12)) set u=CreateUnit(p,'n00T',448.0,448.0,270.000) set u=CreateUnit(p,'n00A',832.,-64.,270.) set u=CreateUnit(p,'n00H',832.,64.,270.) set Demonic_Merchant=CreateUnit(p,'n00U',576.0,448.0,270.000) set Demonic_Gate=CreateUnit(p,'n004',768.0,384.0,270.000) endfunction function CreateNeutralPassive takes nothing returns nothing local player p=Player(15) local unit u local integer unitID local trigger t local real life set u=CreateUnit(p,'h01X',3747.8,3363.9,76.2) set u=CreateUnit(p,'h01X',3744.2,3442.8,76.2) set u=CreateUnit(p,'h01X',3833.4,3368.4,76.2) set u=CreateUnit(p,'h01X',3824.8,3460.6,76.2) set u=CreateUnit(p,'h01X',3911.5,3455.6,76.2) set u=CreateUnit(p,'h01X',4220.8,3522.3,76.2) set u=CreateUnit(p,'h01X',3979.9,3452.2,76.2) set u=CreateUnit(p,'h01X',3968.3,3533.,76.2) set u=CreateUnit(p,'h01X',4054.3,3455.6,76.2) set u=CreateUnit(p,'h01X',4221.8,3398.4,76.2) set u=CreateUnit(p,'h01X',4140.6,3453.9,76.2) endfunction function CreateBloods takes nothing returns nothing local player p=Player(PLAYER_NEUTRAL_PASSIVE) local unit u set u=CreateUnit(p,'hBld',5440.0,-1984.0,270.000) set u=CreateUnit(p,'hBld',-1984.0,-7488.0,270.000) set u=CreateUnit(p,'hBld',5952.0,-6848.0,270.000) set u=CreateUnit(p,'hBld',3776.0,-6848.0,270.000) set u=CreateUnit(p,'hBld',6464.0,320.0,270.000) set u=CreateUnit(p,'hBld',4672.0,-1856.0,270.000) set u=CreateUnit(p,'hBld',6976.0,-1728.0,270.000) set u=CreateUnit(p,'hBld',-1984.0,-3392.0,270.000) set u=CreateUnit(p,'hBld',6592.0,-5184.0,270.000) set u=CreateUnit(p,'hBld',6848.0,-7488.0,270.000) set u=CreateUnit(p,'hBld',-3648.0,-2496.0,270.000) set u=CreateUnit(p,'hBld',-4544.0,-6208.0,270.000) set u=CreateUnit(p,'hBld',-5056.0,6848.0,270.000) set u=CreateUnit(p,'hBld',-7232.0,-704.0,270.000) set u=CreateUnit(p,'hBld',2624.0,-5952.0,270.000) set u=CreateUnit(p,'hBld',-8000.0,-6592.0,270.000) set u=CreateUnit(p,'hBld',-6976.0,-5056.0,270.000) set u=CreateUnit(p,'hBld',-2368.0,-6464.0,270.000) set u=CreateUnit(p,'hBld',-3136.0,-1088.0,270.000) set u=CreateUnit(p,'hBld',-6976.0,1728.0,270.000) set u=CreateUnit(p,'hBld',-3520.0,704.0,270.000) set u=CreateUnit(p,'hBld',-6720.0,5056.0,270.000) set u=CreateUnit(p,'hBld',-6080.0,4160.0,270.000) set u=CreateUnit(p,'hBld',-6592.0,5696.0,270.000) set u=CreateUnit(p,'hBld',64.0,-2880.0,270.000) set u=CreateUnit(p,'hBld',4416.0,2368.0,270.000) set u=CreateUnit(p,'hBld',832.0,4032.0,270.000) set u=CreateUnit(p,'hBld',1728.0,5312.0,270.000) set u=CreateUnit(p,'hBld',1088.0,8000.0,270.000) set u=CreateUnit(p,'hBld',-3648.0,6848.0,270.000) set u=CreateUnit(p,'hBld',3904.0,6080.0,270.000) set u=CreateUnit(p,'hBld',6080.0,6976.0,270.000) set u=CreateUnit(p,'hBld',-2496.0,2752.0,270.000) set u=CreateUnit(p,'hBld',1728.0,-64.0,270.000) set u=CreateUnit(p,'hBld',-2624.0,4416.0,270.000) set u=CreateUnit(p,'hBld',7232.0,3776.0,270.000) set u=CreateUnit(p,'hBld',6080.0,5952.0,270.000) set u=CreateUnit(p,'hBld',1344.0,8000.0,270.000) endfunction function CreateDebugUnits takes nothing returns nothing local unit u local player p set p=Player(0) set u=CreateUnit(p,'h00F',1792.0,-448.0,270.000) set u=CreateUnit(p,'h003',2100.0,-448.0,270.000) if DISABLED>0 then set u=CreateUnit(p,'HSyM',1925.5,-557.0,203.110) call SetHeroLevel(u,20,false) set u=CreateUnit(p,'HSyM',1850.5,-567.0,203.110) call SetHeroLevel(u,20,false) endif set p=Player(1) set u=CreateUnit(p,'h021',1400.0,-448.0,270.000) set u=CreateUnit(p,'h021',1400.0,-448.0,270.000) set u=CreateUnit(p,'h021',1400.0,-448.0,270.000) set u=CreateUnit(p,'h00F',1400.0,-448.0,270.000) set p=Player(10) set u=CreateUnit(p,'h00F',2045.0,-448.0,270.000) if DISABLED>0 then set u=CreateUnit(p,'AVFV',1820.7,-915.0,233.192) call SetHeroLevel(u,30,false) endif call CreateItem('I00G',249.5,33.0) call CreateItem('I00K',266.9,131.9) call CreateItem('I00W',372.8,74.0) call CreateItem('I00V',56.9,52.6) call CreateItem('clfm',99.2,126.0) call CreateItem('I00R',18.1,146.7) call CreateItem('I00I',-350.0,150) call CreateItem('GOHF',-250.0,140) endfunction function CreateAllUnits takes nothing returns nothing call CreateNeutralPassiveBuildings() if DISABLED>0 then call CreateNeutralPassive() endif call CreateBloods() if isDebug>=2 then call CreateDebugUnits() endif endfunction function CreateRegions takes nothing returns nothing local weathereffect we set gg_rct_Base01a=Rect(-8192.,6144.,-7456.,8192.) set gg_rct_Base01b=Rect(-7488.,7520.,-5632.,8192.) set gg_rct_Base01c=Rect(-7072.,6112.,-6240.,7552.) set gg_rct_Base02a=Rect(-8192.,4928.,-6240.,6112.) set gg_rct_Base02b=Rect(-7456.,6080.,-7040.,7488.) set gg_rct_Base02c=Rect(-6272.,4928.,-5632.,7520.) set gg_rct_Base02d=Rect(-5664.,6368.,-4672.,8192.) set gg_rct_Base02e=Rect(-5664.,5184.,-5056.,6400.) set gg_rct_Base03a=Rect(-4512.,6464.,-2304.,7552.) set gg_rct_Base03b=Rect(-4224.,5536.,-2560.,6496.) set gg_rct_Base04a=Rect(-4640.,7616.,-1536.,8160.) set gg_rct_Base04b=Rect(-2240.,6432.,-1536.,7648.) set gg_rct_Base04c=Rect(-2560.,5760.,-1536.,6464.) set gg_rct_Base05a=Rect(-1472.,6272.,1184.,8192.) set gg_rct_Base06a=Rect(1248.,7520.,3328.,8128.) set gg_rct_Base06b=Rect(1280.,4704.,2176.,7552.) set gg_rct_Base07a=Rect(3392.,5216.,4672.,8192.) set gg_rct_Base07b=Rect(2208.,4480.,3392.,7520.) set gg_rct_Base08a=Rect(4672.,5152.,5280.,8192.) set gg_rct_Base08b=Rect(5248.,7584.,8160.,8160.) set gg_rct_Base08c=Rect(7776.,4736.,8160.,7584.) set gg_rct_Base09a=Rect(5248.,4608.,7744.,7584.) set gg_rct_Base10a=Rect(-8192.,3552.,-7072.,4992.) set gg_rct_Base10b=Rect(-7104.,4096.,-6272.,4960.) set gg_rct_Base11a=Rect(-3360.,3648.,-2304.,4512.) set gg_rct_Base11b=Rect(-2880.,1760.,-2304.,3680.) set gg_rct_Base11c=Rect(7264.,1760.,8160.,3040.) set gg_rct_Base12a=Rect(-1920.,4480.,-1216.,5312.) set gg_rct_Base12b=Rect(-2208.,3552.,672.,4512.) set gg_rct_Base12c=Rect(-320.,4480.,672.,5280.) set gg_rct_Base13a=Rect(5632.,3008.,8160.,4576.) set gg_rct_Base13b=Rect(5632.,2304.,7296.,3040.) set gg_rct_Base14a=Rect(-8192.,2144.,-7072.,3584.) set gg_rct_Base14b=Rect(-8192.,896.,-6656.,2176.) set gg_rct_Base14c=Rect(-8192.,-128.,-6912.,928.) set gg_rct_Base15a=Rect(-6208.,2592.,-3552.,3648.) set gg_rct_Base15b=Rect(-6208.,2240.,-5088.,2624.) set gg_rct_Base15c=Rect(-6208.,576.,-5632.,2272.) set gg_rct_Base16a=Rect(-5088.,2208.,-3552.,2592.) set gg_rct_Base16b=Rect(-5568.,-288.,-3552.,2240.) set gg_rct_Base17a=Rect(-2176.,1760.,928.,3456.) set gg_rct_Base17b=Rect(-768.,1088.,928.,1792.) set gg_rct_Base18a=Rect(4704.,576.,5152.,1728.) set gg_rct_Base18b=Rect(3776.,-256.,4736.,2560.) set gg_rct_Base18c=Rect(2464.,-256.,3808.,1984.) set gg_rct_Base19a=Rect(4864.,-160.,5216.,512.) set gg_rct_Base19b=Rect(5184.,-160.,6592.,1600.) set gg_rct_Base20a=Rect(7328.,-96.,8160.,1728.) set gg_rct_Base20b=Rect(6752.,-1344.,8160.,-64.) set gg_rct_Base21a=Rect(-8192.,-2752.,-6368.,-128.) set gg_rct_Base21b=Rect(-8160.,-3200.,-7744.,-2720.) set gg_rct_Base21c=Rect(-8192.,-4064.,-6592.,-3168.) set gg_rct_Base22a=Rect(-6016.,-1920.,-3584.,-512.) set gg_rct_Base22b=Rect(-3616.,-1664.,-2944.,-640.) set gg_rct_Base23a=Rect(-6112.,-4704.,-3520.,-2368.) set gg_rct_Base24a=Rect(-2464.,-2432.,-1152.,-1120.) set gg_rct_Base24b=Rect(-2880.,-3392.,-2432.,-2144.) set gg_rct_Base24c=Rect(-2464.,-3872.,-1792.,-2400.) set gg_rct_Base24d=Rect(-2784.,-4672.,-1408.,-3840.) set gg_rct_Base25a=Rect(-1792.,-3328.,-1152.,-2464.) set gg_rct_Base25b=Rect(-1184.,-3328.,-640.,-2912.) set gg_rct_Base25c=Rect(-1792.,-3872.,-1376.,-3296.) set gg_rct_Base25d=Rect(-1408.,-4832.,.0,-3296.) set gg_rct_Base26a=Rect(2112.,-3360.,4736.,-1024.) set gg_rct_Base27a=Rect(5344.,-2880.,6752.,-224.) set gg_rct_Base27b=Rect(6720.,-2528.,8160.,-1632.) set gg_rct_Base27c=Rect(6720.,-2848.,7552.,-2496.) set gg_rct_Base28a=Rect(-8192.,-6496.,-6784.,-4096.) set gg_rct_Base29a=Rect(-8192.,-8160.,-7104.,-6560.) set gg_rct_Base29b=Rect(-7136.,-8192.,-5152.,-7104.) set gg_rct_Base29c=Rect(-6016.,-6528.,-5152.,-5344.) set gg_rct_Base29d=Rect(-6432.,-7136.,-5152.,-6496.) set gg_rct_Base29e=Rect(-5184.,-8192.,-4064.,-7616.) set gg_rct_Base30a=Rect(-5120.,-7552.,-4096.,-5312.) set gg_rct_Base30b=Rect(-4128.,-6688.,-3456.,-5344.) set gg_rct_Base30c=Rect(5952.,-6176.,8160.,-5184.) set gg_rct_Base31a=Rect(-3456.,-6752.,-1952.,-5280.) set gg_rct_Base31b=Rect(-4096.,-8192.,-1728.,-6720.) set gg_rct_Base32a=Rect(-1920.,-6848.,-192.,-5344.) set gg_rct_Base32b=Rect(-224.,-7360.,1024.,-5984.) set gg_rct_Base33a=Rect(-1728.,-8192.,-224.,-6880.) set gg_rct_Base33b=Rect(-256.,-8192.,1696.,-7360.) set gg_rct_Base33c=Rect(1024.,-7392.,1696.,-6272.) set gg_rct_Base34a=Rect(640.,-5504.,1216.,-4064.) set gg_rct_Base34b=Rect(1184.,-5376.,4192.,-4320.) set gg_rct_Base34c=Rect(1184.,-5984.,3616.,-5344.) set gg_rct_Base35a=Rect(5440.,-4224.,7584.,-2944.) set gg_rct_Base35b=Rect(7552.,-4224.,8160.,-2560.) set gg_rct_Base35c=Rect(5056.,-5184.,8160.,-4192.) set gg_rct_Base36a=Rect(1728.,-8192.,3488.,-6464.) set gg_rct_Base36b=Rect(3456.,-8192.,5696.,-7296.) set gg_rct_Base37a=Rect(5664.,-8192.,8192.,-6144.) set gg_rct_poolMain=Rect(-4864.,5888.,-4512.,6208.) set gg_rct_poolDiscard=Rect(-4224.,4992.,-4096.,5376.) set gg_rct_poolEntire=Rect(-4992.,5760.,-4352.,6272.) set gg_rct_Kill_Zone=Rect(-1152.,-1440.,608.,256.) set gg_rct_spawnHumans=Rect(-672.,-1280.,160.,-992.) set gg_rct_spawnVampires=Rect(-448.,-672.,-64.,-288.) set gg_rct_Teleporto1=Rect(7488.,2624.,7616.,2752.) set gg_rct_Teleporto2=Rect(-3136.,3776.,-3008.,3904.) set gg_rct_Teleporto3=Rect(7872.,-5440.,8000.,-5312.) set gg_rct_Teleporto4=Rect(-4544.,-5696.,-4416.,-5568.) set gg_rct_TeleportRecieveHuman1=Rect(-3136.,3968.,-3008.,4192.) set gg_rct_TeleportRecieveHuman2=Rect(7680.,2624.,7904.,2752.) set gg_rct_TeleportRecieveHuman3=Rect(-4864.,-5696.,-4608.,-5568.) set gg_rct_TeleportRecieveHuman4=Rect(7872.,-5760.,8000.,-5504.) set gg_rct_TeleportRecieveVampire1=Rect(-3136.,4256.,-3008.,4384.) set gg_rct_TeleportRecieveVampire2=Rect(7968.,2624.,8096.,2752.) set gg_rct_TeleportRecieveVampire3=Rect(-5056.,-5696.,-4928.,-5568.) set gg_rct_TeleportRecieveVampire4=Rect(7872.,-5952.,8000.,-5824.) set gg_rct_Base20c=Rect(6912.,-96.,7360.,704.) set gg_rct_Base19c=Rect(6560.,-160.,6912.,704.) set gg_rct_SlayerPool=Rect(3584.,3168.,4928.,3808.) set gg_rct_Center_Right=Rect(1344.0,-832.0,1504.0,-576.0) set gg_rct_Center_Main=Rect(-960.0,-1312.0,1376.0,-288.0) set gg_rct_Center_Bottom=Rect(-960.0,-2272.0,960.0,-1280.0) set gg_rct_Center_Left=Rect(-2112.0,-1024.0,-896.0,-256.0) set gg_rct_Center_Top_Left=Rect(-2112.0,-288.0,-1152.0,96.0) set gg_rct_Center_Top=Rect(-1472.0,-320.0,864.0,672.0) set gg_rct_Center_Top_Right=Rect(832.0,-320.0,1216.0,480.0) set gg_rct_Center_Top_Small=Rect(-1184.0,640.0,-480.0,1088.0) set gg_rct_Center_Bottom_Small=Rect(160.0,-2624.0,960.0,-1984.0) set gg_rct_Center_Left_Small=Rect(-2240.0,-608.0,-2080.0,-256.0) set gg_rct_Slayer_Level_Up_Point=Rect(1728.0,2880.0,3104.0,3904.0) endfunction function InitTrig_initBases takes nothing returns nothing local integer b set b=CreateBase("1") call BaseAddRect(b,gg_rct_Base01a) call BaseAddRect(b,gg_rct_Base01b) call BaseAddRect(b,gg_rct_Base01c) set b=CreateBase("2") call BaseAddRect(b,gg_rct_Base02a) call BaseAddRect(b,gg_rct_Base02b) call BaseAddRect(b,gg_rct_Base02c) call BaseAddRect(b,gg_rct_Base02d) call BaseAddRect(b,gg_rct_Base02e) set b=CreateBase("3") call BaseAddRect(b,gg_rct_Base03a) call BaseAddRect(b,gg_rct_Base03b) set b=CreateBase("4") call BaseAddRect(b,gg_rct_Base04a) call BaseAddRect(b,gg_rct_Base04b) call BaseAddRect(b,gg_rct_Base04c) set b=CreateBase("5") call BaseAddRect(b,gg_rct_Base05a) set b=CreateBase("6") call BaseAddRect(b,gg_rct_Base06a) call BaseAddRect(b,gg_rct_Base06b) set b=CreateBase("7") call BaseAddRect(b,gg_rct_Base07a) call BaseAddRect(b,gg_rct_Base07b) set b=CreateBase("8") call BaseAddRect(b,gg_rct_Base08a) call BaseAddRect(b,gg_rct_Base08b) call BaseAddRect(b,gg_rct_Base08c) set b=CreateBase("9") call BaseAddRect(b,gg_rct_Base09a) set b=CreateBase("10") call BaseAddRect(b,gg_rct_Base10a) call BaseAddRect(b,gg_rct_Base10b) set b=CreateBase("11") call BaseAddRect(b,gg_rct_Base11a) call BaseAddRect(b,gg_rct_Base11b) call BaseAddRect(b,gg_rct_Base11c) set b=CreateBase("12") call BaseAddRect(b,gg_rct_Base12a) call BaseAddRect(b,gg_rct_Base12b) call BaseAddRect(b,gg_rct_Base12c) set b=CreateBase("13") call BaseAddRect(b,gg_rct_Base13a) call BaseAddRect(b,gg_rct_Base13b) set b=CreateBase("14") call BaseAddRect(b,gg_rct_Base14a) call BaseAddRect(b,gg_rct_Base14b) call BaseAddRect(b,gg_rct_Base14c) set b=CreateBase("15") call BaseAddRect(b,gg_rct_Base15a) call BaseAddRect(b,gg_rct_Base15b) call BaseAddRect(b,gg_rct_Base15c) set b=CreateBase("16") call BaseAddRect(b,gg_rct_Base16a) call BaseAddRect(b,gg_rct_Base16b) set b=CreateBase("17") call BaseAddRect(b,gg_rct_Base17a) call BaseAddRect(b,gg_rct_Base17b) set b=CreateBase("18") call BaseAddRect(b,gg_rct_Base18a) call BaseAddRect(b,gg_rct_Base18b) call BaseAddRect(b,gg_rct_Base18c) set b=CreateBase("19") call BaseAddRect(b,gg_rct_Base19a) call BaseAddRect(b,gg_rct_Base19b) call BaseAddRect(b,gg_rct_Base19c) set b=CreateBase("20") call BaseAddRect(b,gg_rct_Base20a) call BaseAddRect(b,gg_rct_Base20b) call BaseAddRect(b,gg_rct_Base20c) set b=CreateBase("21") call BaseAddRect(b,gg_rct_Base21a) call BaseAddRect(b,gg_rct_Base21b) call BaseAddRect(b,gg_rct_Base21c) set b=CreateBase("22") call BaseAddRect(b,gg_rct_Base22a) call BaseAddRect(b,gg_rct_Base22b) set b=CreateBase("23") call BaseAddRect(b,gg_rct_Base23a) set b=CreateBase("24") call BaseAddRect(b,gg_rct_Base24a) call BaseAddRect(b,gg_rct_Base24b) call BaseAddRect(b,gg_rct_Base24c) call BaseAddRect(b,gg_rct_Base24d) set b=CreateBase("25") call BaseAddRect(b,gg_rct_Base25a) call BaseAddRect(b,gg_rct_Base25b) call BaseAddRect(b,gg_rct_Base25c) call BaseAddRect(b,gg_rct_Base25d) set b=CreateBase("26") call BaseAddRect(b,gg_rct_Base26a) set b=CreateBase("27") call BaseAddRect(b,gg_rct_Base27a) call BaseAddRect(b,gg_rct_Base27b) call BaseAddRect(b,gg_rct_Base27c) set b=CreateBase("28") call BaseAddRect(b,gg_rct_Base28a) set b=CreateBase("29") call BaseAddRect(b,gg_rct_Base29a) call BaseAddRect(b,gg_rct_Base29b) call BaseAddRect(b,gg_rct_Base29c) call BaseAddRect(b,gg_rct_Base29d) call BaseAddRect(b,gg_rct_Base29e) set b=CreateBase("30") call BaseAddRect(b,gg_rct_Base30a) call BaseAddRect(b,gg_rct_Base30b) call BaseAddRect(b,gg_rct_Base30c) set b=CreateBase("31") call BaseAddRect(b,gg_rct_Base31a) call BaseAddRect(b,gg_rct_Base31b) set b=CreateBase("32") call BaseAddRect(b,gg_rct_Base32a) call BaseAddRect(b,gg_rct_Base32b) set b=CreateBase("33") call BaseAddRect(b,gg_rct_Base33a) call BaseAddRect(b,gg_rct_Base33b) call BaseAddRect(b,gg_rct_Base33c) set b=CreateBase("34") call BaseAddRect(b,gg_rct_Base34a) call BaseAddRect(b,gg_rct_Base34b) call BaseAddRect(b,gg_rct_Base34c) set b=CreateBase("35") call BaseAddRect(b,gg_rct_Base35a) call BaseAddRect(b,gg_rct_Base35b) call BaseAddRect(b,gg_rct_Base35c) set b=CreateBase("36") call BaseAddRect(b,gg_rct_Base36a) call BaseAddRect(b,gg_rct_Base36b) set b=CreateBase("37") call BaseAddRect(b,gg_rct_Base37a) endfunction function initQuests__CreateInfo takes boolean req returns nothing local quest q=CreateQuest() call QuestSetTitle(q,initQuests__QuestTitle) call QuestSetDescription(q,initQuests__QuestText) call QuestSetIconPath(q,initQuests__QuestIcon) call QuestSetRequired(q,req) call QuestSetDiscovered(q,true) call QuestSetCompleted(q,false) set q=null endfunction function initQuests__CreateQuests takes nothing returns nothing set initQuests__QuestTitle="Instructions (Humans)" set initQuests__QuestIcon="ReplaceableTextures\\CommandButtons\\BTNPeasant.blp" set initQuests__QuestText="How to Win|nKill all vampires. Killing vampires will give you precious gold.|n|nHow to get gold|nWait till 10 minutes|nCollect gold coins|nKill vampires big and small|n|n" call initQuests__CreateInfo(true) set initQuests__QuestTitle="Instructions (Vampires)" set initQuests__QuestIcon="ReplaceableTextures\\CommandButtons\\BTNPeasant.blp" set initQuests__QuestText="How to Win|nKill all Humans. Killed humans will turn to your team unless -nomini is on.|n|nHow to get wood|nWait till 15 minutes" call initQuests__CreateInfo(true) set initQuests__QuestTitle="Commands" set initQuests__QuestIcon="ReplaceableTextures\\WorldEditUI\\Editor-Random-Item.blp" set initQuests__QuestText="-kick <color>|n-allow <color>|n-disallow <color>|n-show|n-reset|n-setname <name>|n|nYou may add colors to your setname command using a Hexadecimal RGB code as follows: -setname #FF00FF<name> where each of the 6 digits ranges from 0-9 and A-F" call initQuests__CreateInfo(true) set initQuests__QuestTitle="Blood?" set initQuests__QuestIcon="ReplaceableTextures\\CommandButtons\\BTNAmbush.blp" set initQuests__QuestText="Blood spot can be defended from the vampire with feeding boxes but preferably Blood Boxes... however dont let them die to the vampires..." call initQuests__CreateInfo(true) set initQuests__QuestTitle="Credits" set initQuests__QuestIcon="ReplaceableTextures\\CommandButtons\\BTNAmbush.blp" set initQuests__QuestText="Map developers:|nSkillet-Collide (Original Map Devloper), Cheekything (Map Developer), Caesio (Map Editor), LordKintaro (Map Developer), d07.RiV (Current Map Developer), Littletiger (Current Map Developer), Davethebat (Current Map Developer)" call initQuests__CreateInfo(false) set initQuests__QuestTitle="More Credits" set initQuests__QuestIcon="ReplaceableTextures\\CommandButtons\\BTNAmbush.blp" set initQuests__QuestText="We would like to thank everybody who has contributed to the development and testing of Vampirism Fire, as well as the rest of the community for their continued support." call initQuests__CreateInfo(false) set initQuests__QuestTitle="Even More Credits" set initQuests__QuestIcon="ReplaceableTextures\\CommandButtons\\BTNAmbush.blp" set initQuests__QuestText="We would also like to thank the following for sponsoring the map:|nJJ2198, YellowSnow, Nemaster203, Moneybags-, Pyro, baxtaber, and bmaker[Lio08]" call initQuests__CreateInfo(false) set initQuests__QuestTitle="" set initQuests__QuestIcon="" set initQuests__QuestText="" call DestroyTimer(GetExpiredTimer()) endfunction function InitTrig_initQuests takes nothing returns nothing local timer t=CreateTimer() call TimerStart(t,.0,false,function initQuests__CreateQuests) set t=null endfunction function InitTrig_initUnits takes nothing returns nothing call RegisterUnitCost('e003',0,400) call RegisterUnitCost('hCmd',400,100000) call RegisterUnitCost('h00B',1,10000) call RegisterUnitCost('hHse',0,10) call RegisterUnitCost('h008',1,3000) call RegisterUnitCost('h003',0,1000) call RegisterUnitCost('h00N',1300,0) call RegisterUnitCost('h00J',0,1000) call RegisterUnitCost('h001',0,50) call RegisterUnitCost('h00Z',10,30000) call RegisterUnitCost('h00F',200,250000) call RegisterUnitCost('h006',0,10000) call RegisterUnitCost('h01R',35,80000) call RegisterUnitCost('h00P',1200,450000) call RegisterUnitCost('h00E',100,150000) call RegisterUnitCost('h005',0,5000) call RegisterUnitCost('h009',0,10000) call RegisterUnitCost('h000',0,250) call RegisterUnitCost('hWhp',0,2000) call RegisterUnitCost('h019',0,80000) call RegisterUnitCost('hBgm',0,20000) call RegisterUnitCost('h004',0,50000) call RegisterUnitCost('h00O',0,60000) call RegisterUnitCost('h00G',20,125000) call RegisterUnitCost('h002',1,150) call RegisterUnitCost('o007',0,50) call RegisterUnitCost('hTnt',0,20) call RegisterUnitCost('hTop',0,50) call RegisterUnitCost('hBrc',0,150) call RegisterUnitCost('o002',10,5000) call RegisterUnitCost('u00F',1,5000) call RegisterUnitCost('u00I',0,15000) call RegisterUnitCost('h00L',1000,200000) call RegisterUnitCost('h00D',40,125000) call RegisterUnitCost('h00H',250,750000) call RegisterUnitCost('h00S',350,150000) call RegisterUnitCost('h00M',1600,1000000) call RegisterUnitCost('h00U','d',100000) call RegisterUnitCost('h00I',30,75000) call RegisterUnitCost('o001',0,2500) call RegisterUnitCost('o000',0,800) call RegisterUnitCost('o004',0,7500) call RegisterUnitCost('o006',2,1000) call RegisterUnitCost('o003',0,'d') call RegisterUnitCost('u003',20,100000) call RegisterUnitCost('u000',1,10000) call RegisterUnitCost('n001',0,50) call RegisterUnitCost('hTMb',1,3500) call RegisterUnitCost('hTFs',0,10000) call RegisterUnitCost('n008',10,50000) call RegisterUnitCost('hTFb',0,4000) call RegisterUnitCost('n006',1,40000) call RegisterUnitCost('hTWb',0,2000) call RegisterUnitCost('h01U',1,15000) call RegisterUnitCost('h020',1,15000) call RegisterUnitCost('hHBT',2000,1000000) call RegisterUnitCost('hss1',3,1000) endfunction function preloadUnits__RemovePreloads takes nothing returns nothing loop exitwhen preloadUnits__pc<=0 set preloadUnits__pc=preloadUnits__pc-1 call ReleaseUnit(preloadUnits__pu[preloadUnits__pc]) set preloadUnits__pu[preloadUnits__pc]=null endloop call DestroyTimer(GetExpiredTimer()) endfunction function preloadUnits__PreloadUnit takes integer id returns nothing set preloadUnits__pu[preloadUnits__pc]=CreateUnit(Player(15),id,2600,6400,270) set preloadUnits__pc=preloadUnits__pc+1 endfunction function InitTrig_preloadUnits takes nothing returns nothing local timer t=CreateTimer() call TimerStart(t,.0,false,function preloadUnits__RemovePreloads) set t=null call preloadUnits__PreloadUnit('U00E') call preloadUnits__PreloadUnit('E000') call preloadUnits__PreloadUnit('E001') call preloadUnits__PreloadUnit('E002') call preloadUnits__PreloadUnit('AFVF') call preloadUnits__PreloadUnit('U00C') call preloadUnits__PreloadUnit('U00B') call preloadUnits__PreloadUnit('U00K') call preloadUnits__PreloadUnit('U00D') call preloadUnits__PreloadUnit('U009') call preloadUnits__PreloadUnit('U007') call preloadUnits__PreloadUnit('U008') call preloadUnits__PreloadUnit('U00A') call preloadUnits__PreloadUnit('HSyM') call preloadUnits__PreloadUnit('H01L') call Preloader("scripts\\VampirismFire.pld") endfunction function InitTrig_initMisc takes nothing returns nothing local texttag t set t=CreateTextTag() call SetTextTagText(t,"Dance|nPool",.023) call SetTextTagPos(t,GetRectCenterX(gg_rct_poolMain),GetRectCenterY(gg_rct_poolMain),0) call SetTextTagColor(t,255,255,255,255) set t=CreateTextTag() call SetTextTagText(t,"Slayers|nLevel|nHere",.023) call SetTextTagPos(t,GetRectCenterX(gg_rct_Slayer_Level_Up_Point),GetRectCenterY(gg_rct_Slayer_Level_Up_Point),0) call SetTextTagColor(t,255,255,255,255) set t=null endfunction function InitTrig_initPrePlayers takes nothing returns nothing local integer i=0 loop exitwhen i>11 if isDebug>0 then if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING then set s__PlayerStruct_state[players[i]]=STATE_PLAYING endif else if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING and GetPlayerController(Player(i))==MAP_CONTROL_USER then set s__PlayerStruct_state[players[i]]=STATE_PLAYING endif endif set i=i+1 endloop endfunction function InitTrig_initPlayers takes nothing returns nothing local integer i=0 local integer hi=0 local integer j local fogmodifier fm local boolean ally loop exitwhen i>11 set fm=CreateFogModifierRect(Player(i),FOG_OF_WAR_FOGGED,GetWorldBounds(),true,false) call FogModifierStart(fm) if s__PlayerStruct_state[players[i]]==STATE_PLAYING and s__PlayerStruct_side[players[i]]!=SIDE_VAMPIRE then set s__PlayerStruct_side[players[i]]=SIDE_HUMAN endif call SetPlayerState(Player(i),PLAYER_STATE_GIVES_BOUNTY,1) if s__PlayerStruct_side[players[i]]==SIDE_HUMAN then set hadHumans=true call SetPlayerState(Player(i),PLAYER_STATE_RESOURCE_GOLD,0) call SetPlayerState(Player(i),PLAYER_STATE_RESOURCE_LUMBER,50) set j=0 loop exitwhen j>numVampTypes call SetPlayerTechMaxAllowed(Player(i),vampTypes[j],0) set j=j+1 endloop set s__PlayerStruct_main[players[i]]=CreateUnit(Player(i),GetPlayerSkin(i),GetRectMinX(gg_rct_spawnHumans)+(GetRectMaxX(gg_rct_spawnHumans)-GetRectMinX(gg_rct_spawnHumans))*(hi-hi/5*5)/4,GetRectMaxY(gg_rct_spawnHumans)-(GetRectMaxY(gg_rct_spawnHumans)-GetRectMinY(gg_rct_spawnHumans))*(hi/5),90) call PauseUnit(s__PlayerStruct_main[players[i]],true) set hi=hi+1 if GetLocalPlayer()==Player(i)then call ClearSelection() call SelectUnit(s__PlayerStruct_main[players[i]],true) endif call SetPlayerTechMaxAllowed(Player(i),DeathRevant__UnitId,0) call SetPlayerTechMaxAllowed(Player(i),Wyrm__WYRMID,0) call SetPlayerTechMaxAllowed(Player(i),'Rufb',0) call SetPlayerTechMaxAllowed(Player(i),'Ruwb',0) call SetPlayerTechMaxAllowed(Player(i),'R00K',0) else set hadVampires=true call SetPlayerState(Player(i),PLAYER_STATE_RESOURCE_GOLD,0) call SetPlayerState(Player(i),PLAYER_STATE_RESOURCE_LUMBER,0) call SetPlayerTechMaxAllowed(Player(i),DeathRevant__UnitId,1) call SetPlayerTechMaxAllowed(Player(i),Wyrm__WYRMID,1) call SetPlayerTechMaxAllowed(Player(i),'Rufb',1) call SetPlayerTechMaxAllowed(Player(i),'Ruwb',1) call SetPlayerTechMaxAllowed(Player(i),'R00K',1) endif call SetPlayerTechMaxAllowed(Player(i),'hFlg',1) call SetPlayerTechMaxAllowed(Player(i),'n001',5) call SetPlayerTechMaxAllowed(Player(i),'h00J',2) call SetPlayerTechMaxAllowed(Player(i),'hWkr',48) call SetPlayerTechMaxAllowed(Player(i),'h007',12) call SetPlayerTechMaxAllowed(Player(i),'h00A',8) call SetPlayerTechMaxAllowed(Player(i),'h00K',6) call SetPlayerTechMaxAllowed(Player(i),'h00T',6) call SetPlayerTechMaxAllowed(Player(i),'hTop',21) call SetPlayerTechMaxAllowed(Player(i),'o003',21) call SetPlayerTechMaxAllowed(Player(i),'h001',12) call SetPlayerTechMaxAllowed(Player(i),'h000',12) call SetPlayerTechMaxAllowed(Player(i),'h01U',1) call SetPlayerTechMaxAllowed(Player(i),'h020',1) call SetPlayerTechMaxAllowed(Player(i),'hHBT',1) call SetPlayerTechMaxAllowed(Player(i),Wyrm__FAKEWYRMID,0) set i=i+1 endloop set i=0 loop exitwhen i>11 set j=0 loop exitwhen j>11 if i!=j and s__PlayerStruct_side[players[i]]==s__PlayerStruct_side[players[j]]then call SetPlayerAlliance(Player(i),Player(j),ALLIANCE_PASSIVE,true) call SetPlayerAlliance(Player(i),Player(j),ALLIANCE_HELP_REQUEST,true) call SetPlayerAlliance(Player(i),Player(j),ALLIANCE_HELP_RESPONSE,true) call SetPlayerAlliance(Player(i),Player(j),ALLIANCE_SHARED_XP,true) call SetPlayerAlliance(Player(i),Player(j),ALLIANCE_SHARED_SPELLS,true) call SetPlayerAlliance(Player(i),Player(j),ALLIANCE_SHARED_VISION,true) call SetPlayerAlliance(Player(i),Player(j),ALLIANCE_SHARED_CONTROL,false) call SetPlayerAlliance(Player(i),Player(j),ALLIANCE_SHARED_ADVANCED_CONTROL,false) endif set j=j+1 endloop set i=i+1 endloop endfunction function InitTrig_resumeUnits takes nothing returns nothing local integer i=0 loop exitwhen i>11 if s__PlayerStruct_side[players[i]]==SIDE_HUMAN then call PauseUnit(s__PlayerStruct_main[players[i]],false) endif set i=i+1 endloop endfunction function vampSpawns__Obliterate takes nothing returns nothing local group g=CreateGroup() local group d local unit u local unit v local integer p call GroupEnumUnitsInRect(g,gg_rct_Kill_Zone,null) loop set u=FirstOfGroup(g) exitwhen u==null call GroupRemoveUnit(g,u) set p=GetPlayerId(GetOwningPlayer(u)) if s__PlayerStruct_side[players[p]]==SIDE_HUMAN then if u==s__PlayerStruct_main[players[p]]then call SetUnitPositionLoc(u,GetRandomLocInRect(gg_rct_poolMain)) else call ExplodeUnit(u) endif endif endloop call DestroyGroup(g) call UpdateAmounts(true) set g=null set d=null set u=null set v=null endfunction function vampSpawns__SpawnVampires takes nothing returns nothing local integer i=0 local integer count=0 local unit u loop exitwhen i>11 if s__PlayerStruct_side[players[i]]==SIDE_VAMPIRE and s__PlayerStruct_main[players[i]]!=null then set count=count+1 call ShowUnit(s__PlayerStruct_main[players[i]],true) call SetPlayerAbilityAvailableBJ(false,'A026',Player(i)) call SetPlayerState(Player(i),PLAYER_STATE_RESOURCE_GOLD,50) if GetLocalPlayer()==Player(i)then call ClearSelection() call SelectUnit(s__PlayerStruct_main[players[i]],true) endif endif set i=i+1 endloop if count==1 then set i=0 loop exitwhen i>11 if s__PlayerStruct_side[players[i]]==SIDE_VAMPIRE and s__PlayerStruct_main[players[i]]!=null then call UnitAddItemById(s__PlayerStruct_main[players[i]],'stwp') endif set i=i+1 endloop endif call vampSpawns__Obliterate() call ExplodePortal() endfunction function vampSpawns__RandomizeVampires takes nothing returns nothing local integer i=0 local integer j local integer r loop exitwhen i>11 if s__PlayerStruct_side[players[i]]==SIDE_VAMPIRE and s__PlayerStruct_state[players[i]]==STATE_PLAYING and s__PlayerStruct_main[players[i]]==null then set r=GetRandomInt(0,numVampTypes-1) set s__PlayerStruct_main[players[i]]=CreateUnit(Player(i),vampTypes[r],GetRectCenterX(gg_rct_spawnVampires),GetRectCenterY(gg_rct_spawnVampires),270) set j=0 loop exitwhen j>=numVampTypes call SetPlayerTechMaxAllowed(Player(i),vampTypes[j],0) set j=j+1 endloop call MoveUnitToRect(s__PlayerStruct_main[players[i]],gg_rct_spawnVampires) call SetHeroLevel(s__PlayerStruct_main[players[i]],3,false) call DecorateVamp(s__PlayerStruct_main[players[i]]) call UnitAddItemById(s__PlayerStruct_main[players[i]],'I01I') call ShowUnit(s__PlayerStruct_main[players[i]],false) endif set i=i+1 endloop endfunction function vampSpawns__OnTimer takes nothing returns nothing set vampSpawns__tCounter=vampSpawns__tCounter-1 if vampSpawns__tCounter>0 then call TimerStart(vampSpawns__tFakeTimer,vampSpawns__tCounter,false,function vampSpawns__OnTimer) call PauseTimer(vampSpawns__tFakeTimer) else call DestroyTimerDialog(vampSpawns__tdlg) call DestroyTimer(vampSpawns__tFakeTimer) set vampSpawns__tdlg=null set vampSpawns__tFakeTimer=null call vampSpawns__SpawnVampires() call PauseTimer(GetExpiredTimer()) call DestroyTimer(GetExpiredTimer()) endif endfunction function vampSpawns__OnInit takes nothing returns nothing local timer t=GetExpiredTimer() call TimerStart(t,50.,false,function vampSpawns__RandomizeVampires) set vampSpawns__tCounter=55 set vampSpawns__tFakeTimer=CreateTimer() call TimerStart(vampSpawns__tFakeTimer,vampSpawns__tCounter,false,function vampSpawns__OnTimer) call PauseTimer(vampSpawns__tFakeTimer) set vampSpawns__tdlg=CreateTimerDialog(vampSpawns__tFakeTimer) call TimerDialogSetTitle(vampSpawns__tdlg,"Vampires arrive") call TimerDialogSetTimeColor(vampSpawns__tdlg,255,4,4,255) call TimerDialogDisplay(vampSpawns__tdlg,true) set t=CreateTimer() call TimerStart(t,1.,true,function vampSpawns__OnTimer) set t=null endfunction function InitTrig_vampSpawns takes nothing returns nothing local timer t=CreateTimer() call TimerStart(t,.01,false,function vampSpawns__OnInit) set t=null endfunction function incomeGoldmine__gmCount takes integer id returns nothing local group g=CreateGroup() local unit u local integer b=GoldMineIncome() call GroupEnumUnitsOfType(g,UnitId2String(id),null) loop set u=FirstOfGroup(g) exitwhen u==null call GroupRemoveUnit(g,u) call AddResources(GetOwningPlayer(u),b,0) endloop call DestroyGroup(g) set g=null endfunction function incomeGoldmine__gmBasic takes nothing returns nothing call incomeGoldmine__gmCount('hBgm') endfunction function incomeGoldmine__gmSuper takes nothing returns nothing call incomeGoldmine__gmCount('h004') endfunction function incomeGoldmine__gmUltra takes nothing returns nothing call incomeGoldmine__gmCount('h00O') endfunction function incomeGoldmine__gmElite takes nothing returns nothing call incomeGoldmine__gmCount('h019') endfunction function InitTrig_incomeGoldmine takes nothing returns nothing local timer t=CreateTimer() call TimerStart(t,60,true,function incomeGoldmine__gmBasic) set t=CreateTimer() call TimerStart(t,15,true,function incomeGoldmine__gmSuper) set t=CreateTimer() call TimerStart(t,6,true,function incomeGoldmine__gmUltra) set t=CreateTimer() call TimerStart(t,4,true,function incomeGoldmine__gmElite) set t=null endfunction function timedStuff__GetResearchCenter takes player p returns nothing local group g=CreateGroup() local unit u set timedStuff__rc=null call GroupEnumUnitsOfType(g,UnitId2String('u00J'),null) loop set u=FirstOfGroup(g) exitwhen u==null call GroupRemoveUnit(g,u) if GetOwningPlayer(u)==p then set timedStuff__rc=u endif endloop call DestroyGroup(g) set g=null endfunction function timedStuff__Init takes integer minus returns nothing local trigger trg=XCreateTrigger() set minus=minus+300 call TriggerRegisterTimerEvent(trg,840-minus,false) call TriggerRegisterTimerEvent(trg,900-minus,false) call TriggerRegisterTimerEvent(trg,1500-minus,false) call TriggerRegisterTimerEvent(trg,2220-minus,false) call TriggerAddCondition(trg,Condition(function messages__OnTimer)) endfunction function timedStuff__OnTimer takes nothing returns boolean local integer i local integer j local integer income local integer gold local integer goldHum local integer wood local group g=CreateGroup() local unit u set timedStuff__curMinute=timedStuff__curMinute+1 set timedStuff__curRealMinute=timedStuff__curRealMinute+1 if timedStuff__curRealMinute==5 then if GameMode==GameMode_SuperFast then set timedStuff__curMinute=timedStuff__curMinute+3 call timedStuff__Init(300) elseif GameMode==GameMode_Fast then call timedStuff__Init(120) else call timedStuff__Init(0) endif endif set income=timedStuff__curMinute/10 if timedStuff__curMinute==(timedStuff__curMinute/10)*10 then set gold=R2I(50*Pow(2.0,income-1)) if income==1 then if GameMode==GameMode_Fast or GameMode==GameMode_SuperFast then set goldHum=15 else set goldHum=2 endif else set goldHum=gold/10 endif set wood=income*1000 if gold>=10000 then set gold=10000 endif if goldHum>=10000 then set goldHum=10000 endif set i=0 loop exitwhen i>11 if s__PlayerStruct_side[players[i]]==SIDE_HUMAN then call AddResources(Player(i),goldHum,0) call DisplayTimedTextToPlayer(Player(i),0,0,0xA,"|cffffcc00You have survived for "+I2S(timedStuff__curRealMinute)+" minutes! All humans have now gained "+I2S(goldHum)+" gold!|r") call DisplayTimedTextToPlayer(Player(i),0,0,0xA,"|cffff0022The Ancient Evils have acquired "+I2S(gold)+" gold and "+I2S(wood)+" lumber!|r") else call AddResources(Player(i),gold,wood) if income==1 then call DisplayTimedTextToPlayer(Player(i),0,0,0xA,"|cffffcc00The Humans have acquired 2 gold! They can now all construct the <Slayer's Vault>|r") else call DisplayTimedTextToPlayer(Player(i),0,0,0xA,"|cffffcc00The Humans have acquired "+I2S(goldHum)+" gold!|r") endif call DisplayTimedTextToPlayer(Player(i),0,0,0xA,"|cffff0022You have acquired "+I2S(gold)+" gold and "+I2S(wood)+" lumber! Use them wisely...|r") endif set i=i+1 endloop endif if GameMode==GameMode_Fast or GameMode==GameMode_GreedyVamps then set income=income*2 elseif GameMode==GameMode_SuperFast then set income=income*3 endif set i=0 loop exitwhen i>11 if s__PlayerStruct_side[players[i]]!=SIDE_HUMAN and s__PlayerStruct_main[players[i]]!=null and s__PlayerStruct_state[players[i]]==STATE_PLAYING then call AddResources(Player(i),25*income,50*income) endif set i=i+1 endloop call GroupEnumUnitsInRect(g,gg_rct_Slayer_Level_Up_Point,null) loop set u=FirstOfGroup(g) exitwhen u==null call GroupRemoveUnit(g,u) if IsSlayer(u)or IsVampire(u)then call SetHeroLevel(u,GetHeroLevel(u)+1,true) endif endloop call DestroyGroup(g) set g=null return false endfunction function timedStuff__AdditionalLvl takes nothing returns boolean local group g=CreateGroup() local unit u local integer chance call GroupEnumUnitsInRect(g,gg_rct_Slayer_Level_Up_Point,null) loop set u=FirstOfGroup(g) exitwhen u==null call GroupRemoveUnit(g,u) if IsSlayer(u)or IsVampire(u)then set chance=GetRandomInt(1,7) if chance==7 then call SetHeroLevel(u,GetHeroLevel(u)+1,true) if IsSlayer(u)then call toHumans(3,GetPlayerNameColored(GetOwningPlayer(u))+" just got lucky level to his "+GetUnitName(u)) endif endif endif endloop call DestroyGroup(g) set g=null return false endfunction function InitTrig_timedStuff takes nothing returns nothing local trigger trg1=XCreateTrigger() local trigger trg2=XCreateTrigger() call TriggerRegisterTimerEvent(trg1,60,true) call TriggerAddCondition(trg1,Condition(function timedStuff__OnTimer)) set trg1=null call TriggerRegisterTimerEvent(trg2,30,true) call TriggerAddCondition(trg2,Condition(function timedStuff__AdditionalLvl)) set trg2=null endfunction function afk__OnOrder takes nothing returns boolean set s__PlayerStruct_actionTimer[(players[GetPlayerId((GetTriggerPlayer()))])]=(libBase__bigGameTime+TimerGetElapsed(libBase__bigGameTimer)) return false endfunction function afk__OnAfk takes nothing returns boolean local integer i=0 local integer s=s__PlayerStruct_side[(players[GetPlayerId((GetTriggerPlayer()))])] loop exitwhen i>11 if(s==SIDE_HUMAN or s__PlayerStruct_side[players[i]]!=SIDE_HUMAN)and s__PlayerStruct_state[players[i]]==STATE_PLAYING and(libBase__bigGameTime+TimerGetElapsed(libBase__bigGameTimer))-s__PlayerStruct_actionTimer[players[i]]>60 then call DisplayTimedTextToPlayer(GetTriggerPlayer(),0,0,10,GetPlayerNameColored(Player(i))+" has been afk for "+TimeString((libBase__bigGameTime+TimerGetElapsed(libBase__bigGameTimer))-s__PlayerStruct_actionTimer[players[i]])) endif set i=i+1 endloop return false endfunction function InitTrig_afk takes nothing returns nothing local trigger trg=CreateTrigger() call TriggerRegisterAnyUnitEvent(trg,EVENT_PLAYER_UNIT_ISSUED_ORDER,null) call TriggerRegisterAnyUnitEvent(trg,EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER,null) call TriggerRegisterAnyUnitEvent(trg,EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER,null) call TriggerAddCondition(trg,Condition(function afk__OnOrder)) set trg=CreateTrigger() call TriggerRegisterAnyPlayerChatEvent(trg,"-afk",true) call TriggerAddCondition(trg,Condition(function afk__OnAfk)) set trg=null endfunction function sendResources__Trim takes string s returns string loop exitwhen StringLength(s)==0 exitwhen SubString(s,0,1)!=" " set s=SubString(s,1,StringLength(s)) endloop loop exitwhen StringLength(s)==0 exitwhen SubString(s,StringLength(s)-1,StringLength(s))!=" " set s=SubString(s,0,StringLength(s)-1) endloop return s endfunction function sendResources__ParseInt takes string s returns integer local string d="0123456789" local integer r=0 local integer i=0 local integer m local string c if s=="" then return-1 endif loop exitwhen i>=StringLength(s) set c=SubString(s,i,i+1) set m=0 loop exitwhen m>=10 exitwhen SubString(d,m,m+1)==c set m=m+1 endloop if m<10 then set r=r*10+m elseif c=="k" or c=="K" then if i<StringLength(s)-1 then return-1 endif set r=r*1000 else return-1 endif if r>=1000000 then return 1000000 endif set i=i+1 endloop return r endfunction function sendResources__ParseAmount takes string s returns nothing local integer i set sendResources__r_player=null set sendResources__r_amount=0 set s=sendResources__Trim(s) set i=StringLength(s)-1 loop exitwhen i<0 exitwhen SubString(s,i,i+1)==" " set i=i-1 endloop if i<0 then return endif set sendResources__r_amount=sendResources__ParseInt(SubString(s,i+1,StringLength(s))) if sendResources__r_amount>=0 then set sendResources__r_player=GetPlayerByName(sendResources__Trim(SubString(s,0,i))) endif endfunction function reduceArmorOnExpire takes nothing returns nothing local timer t=GetExpiredTimer() local unit u=(LoadUnitHandle(armor__tht,GetHandleId(t),HASH_ATTACH0)) local integer i=0 loop exitwhen i>15 call UnitRemoveAbility(u,BloodTower__abils[i]) set i=i+1 endloop call PauseTimer(t) call DestroyTimer(t) set t=null endfunction function reduceArmorByPercent takes unit target,real percent,integer abl,real duration returns nothing local integer c=32768 local integer i=15 local integer id=GetUnitTypeId(target) local player p=GetOwningPlayer(target) local timer t local unit d local integer lvl=GetPlayerTechCount(p,'Rhar',true)+GetPlayerTechCount(p,'R00Q',true) local real amount=(LoadInteger(armor__tht,id,HASH_ATTACH0)+LoadInteger(armor__tht,id,HASH_ATTACH1)*lvl)*percent set t=CreateTimer() call SaveUnitHandle(armor__tht,GetHandleId(t),HASH_ATTACH0,target) call TimerStart(t,duration,false,function reduceArmorOnExpire) loop exitwhen i<0 if c<=amount then set amount=amount-c call UnitAddAbility(target,BloodTower__abils[i]) call UnitMakeAbilityPermanent(target,true,BloodTower__abils[i]) else call UnitRemoveAbility(target,BloodTower__abils[i]) endif set c=c/2 set i=i-1 endloop call DummySpellTarget(p,target,abl,"bloodlust") endfunction function sendResources__OnGold takes nothing returns boolean local string s=GetEventPlayerChatString() local player p=GetTriggerPlayer() local boolean taxes=false local integer deliveryCost=0 local integer originalAmount=0 if s__PlayerStruct_side[players[GetPlayerId(p)]]==SIDE_HUMAN then set taxes=true endif if SubString(s,0,6)!="-gold " then return false endif call sendResources__ParseAmount(SubString(s,6,StringLength(s))) if sendResources__r_player==null then call DisplayTimedTextToPlayer(p,0,0,10,"|cffff0000Syntax: -gold <player number/color> <amount>|r") elseif p==sendResources__r_player or(not IsPlayerAlly(p,sendResources__r_player))or s__PlayerStruct_state[(players[GetPlayerId((sendResources__r_player))])]!=STATE_PLAYING then call DisplayTimedTextToPlayer(p,0,0,10,"|cffff0000Can only send resources to allies|r") else if sendResources__r_amount>GetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD)then set sendResources__r_amount=GetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD) endif set originalAmount=sendResources__r_amount if taxes then if sendResources__r_amount<4 then return false else set sendResources__r_amount=R2I(sendResources__r_amount*0.25) set deliveryCost=originalAmount-sendResources__r_amount endif endif if sendResources__r_amount>0 then call SetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD)-originalAmount) call SetPlayerState(sendResources__r_player,PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(sendResources__r_player,PLAYER_STATE_RESOURCE_GOLD)+sendResources__r_amount) call DisplayTimedTextToPlayer(p,0,0,15,"|cffffcc00Sent "+I2S(sendResources__r_amount)+" gold to "+GetPlayerNameColored(sendResources__r_player)) call DisplayTimedTextToPlayer(sendResources__r_player,0,0,15,"|cffffcc00Received "+I2S(sendResources__r_amount)+" gold from "+GetPlayerNameColored(p)) if taxes then call DisplayTimedTextToPlayer(p,0,0,15,"|cffffcc00Cost of delivery: "+I2S(deliveryCost)+" gold") call DisplayTimedTextToPlayer(sendResources__r_player,0,0,15,"|cffffcc00Cost of delivery: "+I2S(deliveryCost)+" gold") endif endif endif return false endfunction function sendResources__OnWood takes nothing returns boolean local string s=GetEventPlayerChatString() local player p=GetTriggerPlayer() local boolean taxes=false local integer deliveryCost=0 local integer originalAmount=0 if s__PlayerStruct_side[players[GetPlayerId(p)]]==SIDE_HUMAN then set taxes=true endif if SubString(s,0,6)=="-wood " then call sendResources__ParseAmount(SubString(s,6,StringLength(s))) elseif SubString(s,0,8)=="-lumber " then call sendResources__ParseAmount(SubString(s,8,StringLength(s))) else return false endif if sendResources__r_player==null then call DisplayTimedTextToPlayer(p,0,0,10,"|cffff0000Syntax: -wood <player number/color> <amount>|r") elseif p==sendResources__r_player or(not IsPlayerAlly(p,sendResources__r_player))or s__PlayerStruct_state[(players[GetPlayerId((sendResources__r_player))])]!=STATE_PLAYING then call DisplayTimedTextToPlayer(p,0,0,10,"|cffff0000Can only send resources to allies|r") else if sendResources__r_amount>GetPlayerState(p,PLAYER_STATE_RESOURCE_LUMBER)then set sendResources__r_amount=GetPlayerState(p,PLAYER_STATE_RESOURCE_LUMBER) endif set originalAmount=sendResources__r_amount if taxes then if sendResources__r_amount<4 then return false else set sendResources__r_amount=R2I(sendResources__r_amount*0.25) set deliveryCost=originalAmount-sendResources__r_amount endif endif if sendResources__r_amount>0 then call SetPlayerState(p,PLAYER_STATE_RESOURCE_LUMBER,GetPlayerState(p,PLAYER_STATE_RESOURCE_LUMBER)-originalAmount) call SetPlayerState(sendResources__r_player,PLAYER_STATE_RESOURCE_LUMBER,GetPlayerState(sendResources__r_player,PLAYER_STATE_RESOURCE_LUMBER)+sendResources__r_amount) call DisplayTimedTextToPlayer(p,0,0,15,"|cff9dbb61Sent "+I2S(sendResources__r_amount)+" lumber to "+GetPlayerNameColored(sendResources__r_player)) call DisplayTimedTextToPlayer(sendResources__r_player,0,0,15,"|cff9dbb61Received "+I2S(sendResources__r_amount)+" lumber from "+GetPlayerNameColored(p)) if taxes then call DisplayTimedTextToPlayer(p,0,0,15,"|cffffcc00Cost of delivery: "+I2S(deliveryCost)+" lumber") call DisplayTimedTextToPlayer(sendResources__r_player,0,0,15,"|cffffcc00Cost of delivery: "+I2S(deliveryCost)+" lumber") endif endif endif return false endfunction function sendResources__OnDebug takes nothing returns boolean local player p=GetTriggerPlayer() call SetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD,10000000) call SetPlayerState(p,PLAYER_STATE_RESOURCE_LUMBER,10000000) return false endfunction function InitTrig_sendResources takes nothing returns nothing local trigger trg_gold=XCreateTrigger() local trigger trg_wood=XCreateTrigger() local trigger trg_debug=XCreateTrigger() local integer i=0 set i=0 loop exitwhen i>11 call TriggerRegisterPlayerChatEvent(trg_gold,Player(i),"-gold ",false) call TriggerRegisterPlayerChatEvent(trg_wood,Player(i),"-wood ",false) call TriggerRegisterPlayerChatEvent(trg_debug,Player(i),"-debug",false) set i=i+1 endloop call TriggerAddCondition(trg_gold,Condition(function sendResources__OnGold)) call TriggerAddCondition(trg_wood,Condition(function sendResources__OnWood)) if isDebug>0 then call TriggerAddCondition(trg_debug,Condition(function sendResources__OnDebug)) endif set trg_gold=null set trg_wood=null set trg_debug=null endfunction function nomini__NoMini takes nothing returns boolean local integer p=GetPlayerId(GetTriggerPlayer()) local boolean yes=(GetEventPlayerChatString()=="-yesmini") if s__PlayerStruct_side[players[p]]==SIDE_VAMPIRE and s__PlayerStruct_allowMini[players[p]]!=yes then if yes then call DisplayTextToPlayer(Player(p),0,0,"|cffffcc00Humans you kill will now revive as your minions (cancel with -nomini)|r") else call DisplayTextToPlayer(Player(p),0,0,"|cffffcc00Humans you kill will no longer revive as your minions (cancel with -yesmini)|r") endif endif return false endfunction function InitTrig_nomini takes nothing returns nothing local trigger trg=XCreateTrigger() local integer i=0 loop exitwhen i>11 call TriggerRegisterPlayerChatEvent(trg,Player(i),"-nomini",true) call TriggerRegisterPlayerChatEvent(trg,Player(i),"-yesmini",true) set i=i+1 endloop call TriggerAddCondition(trg,Condition(function nomini__NoMini)) set trg=null endfunction function bases__PingBases takes nothing returns boolean if GetLocalPlayer()==GetTriggerPlayer()then call PingAllBases(5.) endif return false endfunction function InitTrig_bases takes nothing returns nothing local trigger trg=XCreateTrigger() local integer i=0 loop exitwhen i>11 call TriggerRegisterPlayerChatEvent(trg,Player(i),"-bases",true) set i=i+1 endloop call TriggerAddCondition(trg,Condition(function bases__PingBases)) set trg=null endfunction function clear__OnClear takes nothing returns boolean if GetLocalPlayer()==GetTriggerPlayer()then call ClearTextMessages() endif return false endfunction function InitTrig_clear takes nothing returns nothing local trigger trg=XCreateTrigger() local integer i=0 loop exitwhen i>11 call TriggerRegisterPlayerChatEvent(trg,Player(i),"-clear",true) set i=i+1 endloop call TriggerAddCondition(trg,Condition(function clear__OnClear)) set trg=null endfunction function setname__CharInSet takes string c,string s returns boolean local integer i=0 loop exitwhen i>=StringLength(s) if c==SubString(s,i,i+1)then return true endif set i=i+1 endloop return false endfunction function setname__SanitizeColor takes string color returns string local string r="" local integer i=0 loop exitwhen i>=6 exitwhen i>=StringLength(color) if setname__CharInSet(SubString(color,i,i+1),"0123456789abcdefABCDEF")then set r=r+SubString(color,i,i+1) else set r=r+"f" endif set i=i+1 endloop loop exitwhen i>=6 set r=r+"f" set i=i+1 endloop return r endfunction function setname__SetName takes nothing returns boolean local string input=SubString(GetEventPlayerChatString(),9,StringLength(GetEventPlayerChatString())) local string output=s__Color_web[colors[GetPlayerId(GetTriggerPlayer())]]+"»|r " local string c="" local integer i=0 local string allow="!$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\"" if GetEventPlayerChatString()=="-reset" then call SetPlayerName(GetTriggerPlayer(),s__PlayerStruct_name[players[GetPlayerId(GetTriggerPlayer())]]) call UpdateMultiboardPlayer(GetPlayerId(GetTriggerPlayer())) endif if SubString(GetEventPlayerChatString(),0,9)!="-setname " then return false endif loop exitwhen i>=StringLength(input) set c=SubString(input,i,i+1) if c=="#" then set output=output+"|cff"+setname__SanitizeColor(SubString(input,i+1,i+7)) set i=i+7 elseif c==" " then set i=999 else if setname__CharInSet(c,allow)then set output=output+c endif set i=i+1 endif endloop call SetPlayerName(GetTriggerPlayer(),output) call UpdateMultiboardPlayer(GetPlayerId(GetTriggerPlayer())) return false endfunction function InitTrig_setname takes nothing returns nothing local trigger trg=XCreateTrigger() local integer i=0 loop exitwhen i>11 call TriggerRegisterPlayerChatEvent(trg,Player(i),"-setname ",false) call TriggerRegisterPlayerChatEvent(trg,Player(i),"-reset",true) set i=i+1 endloop call TriggerAddCondition(trg,Condition(function setname__SetName)) endfunction function show__Show takes nothing returns boolean local integer i=0 local string s local integer maxhuman=1 local integer minhuman=0 local integer maxvamp=1 local integer minvamp=0 local string leaks if GetLocalPlayer()==GetTriggerPlayer()then call ClearTextMessages() endif loop exitwhen i>11 if s__PlayerStruct_humanFeed[players[i]]>maxhuman then set maxhuman=s__PlayerStruct_humanFeed[players[i]] endif if s__PlayerStruct_humanFeed[players[i]]<minhuman then set minhuman=s__PlayerStruct_humanFeed[players[i]] endif if s__PlayerStruct_vampireGoldLeaks[players[i]]>maxvamp then set maxvamp=s__PlayerStruct_vampireGoldLeaks[players[i]] endif if s__PlayerStruct_vampireGoldLeaks[players[i]]<minvamp then set minvamp=s__PlayerStruct_vampireGoldLeaks[players[i]] endif set i=i+1 endloop set i=0 loop exitwhen i>11 if s__PlayerStruct_state[players[i]]!=0 then if s__PlayerStruct_state[players[i]]==STATE_PLAYING then set s=s__Color_web[colors[i]]+"» "+s__PlayerStruct_name[players[i]]+": |r" if s__PlayerStruct_side[players[i]]==SIDE_HUMAN then set s=s+"|cff6DCFF6Human|r" elseif s__PlayerStruct_side[players[i]]==SIDE_VAMPIRE then set s=s+"|cff603913Ancient Vampire|r" elseif s__PlayerStruct_side[players[i]]==SIDE_MINION then set s=s+"|cff8C6239Vampire|r" endif elseif s__PlayerStruct_state[players[i]]==STATE_DEAD then set s=s__Color_web[colors[i]]+"» |cff545454"+s__PlayerStruct_name[players[i]]+": Dead|r" elseif s__PlayerStruct_state[players[i]]==STATE_LEFT then set s=s__Color_web[colors[i]]+"» |cffC4C4C4"+s__PlayerStruct_name[players[i]]+": Left|r" endif if s__PlayerStruct_side[players[i]]==SIDE_HUMAN and s__PlayerStruct_humanFeed[players[i]]>0 then if s__PlayerStruct_humanFeed[players[i]]>=maxhuman then set s=s+" |cffff0404(Fed "+I2S(s__PlayerStruct_humanFeed[players[i]])+" gold)|r" elseif s__PlayerStruct_humanFeed[players[i]]<=minhuman then set s=s+" |cff20c000(Fed "+I2S(s__PlayerStruct_humanFeed[players[i]])+" gold)|r" else set s=s+" |cffffcc00(Fed "+I2S(s__PlayerStruct_humanFeed[players[i]])+" gold)|r" endif elseif s__PlayerStruct_side[players[i]]!=SIDE_HUMAN and(s__PlayerStruct_vampireGoldLeaks[players[i]]>0 or s__PlayerStruct_vampireWoodLeaks[players[i]]>0)then set leaks="(Leaked "+I2S(s__PlayerStruct_vampireGoldLeaks[players[i]])+" gold / "+I2S(s__PlayerStruct_vampireWoodLeaks[players[i]]*3)+"k wood)|r" if s__PlayerStruct_vampireGoldLeaks[players[i]]==maxvamp then set s=s+" |cffff0404"+leaks elseif s__PlayerStruct_vampireGoldLeaks[players[i]]==minvamp then set s=s+" |cff20c000 "+leaks else set s=s+" |cffffcc00 "+leaks endif endif call DisplayTimedTextToPlayer(GetTriggerPlayer(),0,0,15,s) endif set i=i+1 endloop call DisplayAmounts(GetPlayerId(GetTriggerPlayer())) return false endfunction function InitTrig_show takes nothing returns nothing local trigger trg=XCreateTrigger() local integer i=0 loop exitwhen i>11 call TriggerRegisterPlayerChatEvent(trg,Player(i),"-show",true) set i=i+1 endloop call TriggerAddCondition(trg,Condition(function show__Show)) endfunction function show__Feed takes nothing returns boolean local integer feedSum=0 local integer i=0 loop exitwhen i>11 set feedSum=feedSum+s__PlayerStruct_humanFeed[players[i]] set i=i+1 endloop call DisplayTimedTextToPlayer(GetTriggerPlayer(),0,0,15,"Total feed by humans: "+I2S(feedSum)+" gold") return false endfunction function show__Workers takes nothing returns boolean local integer i=0 local group gF=CreateGroup() local group g1=CreateGroup() local group g2=CreateGroup() local group gC local player p=GetTriggerPlayer() local unit u1 local unit u2 local integer clr=colors[GetPlayerId(p)] call GroupEnumUnitsOfPlayer(gF,p,null) loop set u1=FirstOfGroup(gF) exitwhen u1==null call GroupRemoveUnit(gF,u1) if GetUnitTypeId(u1)=='hWkr' then call GroupAddUnit(g1,u1) call GroupAddUnit(g2,u1) endif endloop call DestroyGroup(gF) loop set u1=FirstOfGroup(g1) exitwhen u1==null call GroupRemoveUnit(g1,u1) set gC=CreateGroup() call GroupEnumUnitsInRange(gC,GetUnitX(u1),GetUnitY(u1),100,null) loop set u2=FirstOfGroup(gC) exitwhen u2==null call GroupRemoveUnit(gC,u2) if IsUnitInGroup(u2,g2)and u1 !=u2 then call GroupRemoveUnit(g2,u2) call GroupRemoveUnit(g1,u2) endif endloop endloop call DestroyGroup(g1) call DestroyGroup(gC) loop set u1=FirstOfGroup(g2) exitwhen u1==null call GroupRemoveUnit(g2,u1) if GetLocalPlayer()==p then call PingMinimapEx(GetUnitX(u1),GetUnitY(u1),10,s__Color_red[clr],s__Color_green[clr],s__Color_blue[clr],false) endif endloop call DestroyGroup(g2) set g1=null set g2=null set gC=null set gF=null set p=null return false endfunction function GameMode_Change takes nothing returns boolean local string s=GetEventPlayerChatString() local player p=GetTriggerPlayer() if timedStuff__curRealMinute<5 then if s=="-normal" then set GameMode=GameMode_Nomal set Demonic_Merchant=ReplaceUnit(Demonic_Merchant,'n00U') set Demonic_Gate=ReplaceUnit(Demonic_Gate,'n004') call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15,"|cffffaa00Game mode set to \"Normal\"") elseif s=="-fast" then set GameMode=GameMode_Fast set Demonic_Merchant=ReplaceUnit(Demonic_Merchant,'n00V') set Demonic_Gate=ReplaceUnit(Demonic_Gate,'n00R') call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15,"|cffffaa00Game mode set to \"Fast\"") elseif s=="-superfast" or s=="-sf" then set GameMode=GameMode_SuperFast set Demonic_Merchant=ReplaceUnit(Demonic_Merchant,'n00W') set Demonic_Gate=ReplaceUnit(Demonic_Gate,'n00X') call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15,"|cffffaa00Game mode set to \"Super Fast\"") elseif s=="-greedyvamps" or s=="-gv" then set Demonic_Merchant=ReplaceUnit(Demonic_Merchant,'n00U') set Demonic_Gate=ReplaceUnit(Demonic_Gate,'n004') set GameMode=GameMode_GreedyVamps call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15,"|cffffaa00Game mode set to \"Greedy Vamps\"") endif if GameMode==GameMode_SuperFast then set Income_Add=1 else set Income_Add=0 endif else call DisplayTimedTextToPlayer(GetTriggerPlayer(),0,0,15,"Too late!") endif return false endfunction function VampLives_Set takes nothing returns boolean local string s=GetEventPlayerChatString() local player p=GetTriggerPlayer() local integer newVal=0 local integer i=0 if timedStuff__curMinute<5 then set newVal=S2I(SubString(s,10,StringLength(s))) if newVal>=0 and newVal<=7then set vampLives=newVal call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15,"|cffffaa00Number of Vampires lives is set to \"" + I2S(newVal) +"\"") else call DisplayTimedTextToPlayer(GetTriggerPlayer(),0,0,15,"|cffff0000Incorrect syntax!") endif else call DisplayTimedTextToPlayer(GetTriggerPlayer(),0,0,15,"|cffff0000Too late!") endif return false endfunction function InitTrig_newCommands takes nothing returns nothing local trigger trg1=XCreateTrigger() local trigger trg2=XCreateTrigger() local trigger trg3=XCreateTrigger() local trigger trg4=XCreateTrigger() local integer i=0 loop exitwhen i>11 call TriggerRegisterPlayerChatEvent(trg1,Player(i),"-workers",true) call TriggerRegisterPlayerChatEvent(trg1,Player(i),"-w",true) call TriggerRegisterPlayerChatEvent(trg2,Player(i),"-feed",true) set i=i+1 endloop call TriggerAddCondition(trg1,Condition(function show__Workers)) call TriggerAddCondition(trg2,Condition(function show__Feed)) call TriggerRegisterPlayerChatEvent(trg3,Player(0),"-normal",true) call TriggerRegisterPlayerChatEvent(trg3,Player(0),"-fast",true) call TriggerRegisterPlayerChatEvent(trg3,Player(0),"-superfast",true) call TriggerRegisterPlayerChatEvent(trg3,Player(0),"-sv",true) call TriggerRegisterPlayerChatEvent(trg3,Player(0),"-greedyvamps",true) call TriggerRegisterPlayerChatEvent(trg3,Player(0),"-gd",true) call TriggerAddCondition(trg3,Condition(function GameMode_Change)) call TriggerRegisterPlayerChatEvent(trg4,Player(0),"-vamplives ",false) call TriggerAddCondition(trg4,Condition(function VampLives_Set)) set trg1=null set trg2=null set trg3=null set trg4=null endfunction function kick__GetNeededVotes takes integer n returns integer if n>=8 then return n-3 elseif n>=6 then return n-2 elseif n>=3 then return n-1 endif return n endfunction function kick__DoKick takes player pK returns nothing local integer p=GetPlayerId(pK) if GetLocalPlayer()==pK then call DisplayTimedTextToPlayer(pK,0,0,3600,"|cffff0000You have been removed from the game.|r") else call DisplayTimedTextToPlayer(pK,0,0,3600,GetPlayerNameColored(pK)+"|cffff0000 has been removed from the game.|r") endif call RemovePlayer(pK,PLAYER_GAME_RESULT_DEFEAT) if s__PlayerStruct_side[players[p]]==SIDE_HUMAN then if s__PlayerStruct_state[players[p]]==STATE_PLAYING then set s__PlayerStruct_state[players[p]]=STATE_LEFT call SetPlayerName(pK,s__PlayerStruct_name[players[p]]+" (Kicked)") call OnPlayerLeft(p) elseif s__PlayerStruct_state[players[p]]==STATE_DEAD then set s__PlayerStruct_state[players[p]]=STATE_LEFT call SetPlayerName(pK,s__PlayerStruct_name[players[p]]+" (Dead & Kicked)") endif elseif s__PlayerStruct_side[players[p]]==SIDE_MINION and s__PlayerStruct_state[players[p]]==STATE_DEAD then set s__PlayerStruct_state[players[p]]=STATE_LEFT call SetPlayerName(pK,s__PlayerStruct_name[players[p]]+" (Dead & Kicked)") endif call UpdateAmounts(true) endfunction function kick__OnVKExpire takes nothing returns nothing local integer pL=GetPlayerId(GetLocalPlayer()) if s__PlayerStruct_side[players[pL]]==SIDE_HUMAN and s__PlayerStruct_state[players[pL]]==STATE_PLAYING then call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15,"|cffffcc00Votekick has expired without enough votes|r") endif call PauseTimer(kick__vkTimer) set kick__vkPlayer=null endfunction function kick__OnVote takes nothing returns boolean local integer r local integer p=GetPlayerId(GetTriggerPlayer()) local integer nYes=0 local integer nNo=0 local integer i=0 local integer old local string res local integer pL=GetPlayerId(GetLocalPlayer()) if GetEventPlayerChatString()=="-yes" then set r=1 set res="\"yes\"" else set r=-1 set res="\"no\"" endif if kick__vkPlayer!=null then set old=kick__vkVoted[p] set kick__vkVoted[p]=r loop exitwhen i>11 if s__PlayerStruct_side[players[i]]==SIDE_HUMAN and s__PlayerStruct_state[players[i]]==STATE_PLAYING then if kick__vkVoted[i]<0 then set nNo=nNo+1 elseif kick__vkVoted[i]>0 then set nYes=nYes+1 endif endif set i=i+1 endloop if nYes>=kick__GetNeededVotes(numHumans)then call kick__DoKick(kick__vkPlayer) set kick__vkPlayer=null call PauseTimer(kick__vkTimer) elseif numHumans-nNo<kick__GetNeededVotes(numHumans)then set kick__vkPlayer=null call PauseTimer(kick__vkTimer) if s__PlayerStruct_side[players[pL]]==SIDE_HUMAN and s__PlayerStruct_state[players[pL]]==STATE_PLAYING then call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15,"|cffffcc00Too many players voted against the kick|r") endif else if s__PlayerStruct_side[players[pL]]==SIDE_HUMAN and s__PlayerStruct_state[players[pL]]==STATE_PLAYING then call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,15,GetPlayerNameColored(GetTriggerPlayer())+"|cffffcc00 voted "+res+". "+I2S(kick__GetNeededVotes(numHumans)-nYes)+" more votes are needed to pass|r") endif endif endif return false endfunction function kick__OnKick takes nothing returns boolean local integer i local string s=GetEventPlayerChatString() local player pK=GetPlayerByName(SubString(s,6,StringLength(s))) local integer p=GetPlayerId(pK) local integer pI=GetPlayerId(GetTriggerPlayer()) local integer pL=GetPlayerId(GetLocalPlayer()) if pK==null then return false endif if pI==gameHost and s__PlayerStruct_state[players[pI]]==STATE_PLAYING and s__PlayerStruct_side[players[pI]]==SIDE_HUMAN and s__PlayerStruct_side[players[p]]==SIDE_HUMAN and s__PlayerStruct_state[players[p]]!=STATE_LEFT and pI!=p and s__PlayerStruct_skin[players[p]]!=SKIN_OK then call kick__DoKick(pK) elseif(s__PlayerStruct_side[players[gameHost]]!=SIDE_HUMAN or s__PlayerStruct_state[players[gameHost]]!=STATE_PLAYING)and s__PlayerStruct_side[players[pI]]==SIDE_HUMAN and s__PlayerStruct_state[players[pI]]==STATE_PLAYING and s__PlayerStruct_side[players[p]]==SIDE_HUMAN and s__PlayerStruct_state[players[p]]!=STATE_LEFT and pI!=p and s__PlayerStruct_skin[players[p]]!=SKIN_OK then if kick__vkPlayer!=null then call DisplayTimedTextToPlayer(GetTriggerPlayer(),0,0,15.,"|cffff0000Votekick already in progress|r") else if s__PlayerStruct_side[players[pL]]==SIDE_HUMAN and s__PlayerStruct_state[players[pL]]==STATE_PLAYING then call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60.,"|cffffcc00Votekick against player "+GetPlayerNameColored(pK)+"|cffffcc00 has been initiated by "+GetPlayerNameColored(Player(pI))) call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60.,"|cffffcc00Type -yes or -no to vote for or against the kick. "+I2S(kick__GetNeededVotes(numHumans))+" votes are needed to pass|r") endif set kick__vkPlayer=pK call TimerStart(kick__vkTimer,60.,false,function kick__OnVKExpire) loop exitwhen i>11 set kick__vkVoted[i]=0 set i=i+1 endloop set kick__vkVoted[pI]=1 endif elseif s__PlayerStruct_side[players[pI]]==SIDE_VAMPIRE and s__PlayerStruct_state[players[pI]]==STATE_PLAYING and s__PlayerStruct_side[players[p]]==SIDE_MINION and s__PlayerStruct_state[players[p]]==STATE_DEAD and pI!=p and s__PlayerStruct_skin[players[p]]!=SKIN_OK then call kick__DoKick(pK) endif return false endfunction function InitTrig_kick takes nothing returns nothing local trigger trg=XCreateTrigger() local trigger vck=XCreateTrigger() local integer i=0 loop exitwhen i>11 call TriggerRegisterPlayerChatEvent(vck,Player(i),"-yes",true) call TriggerRegisterPlayerChatEvent(vck,Player(i),"-no",true) set i=i+1 endloop call TriggerAddCondition(trg,Condition(function kick__OnKick)) call TriggerAddCondition(vck,Condition(function kick__OnVote)) endfunction function stopAttack__OnDamage takes nothing returns boolean local unit a=GetEventDamageSource() local unit d=GetTriggerUnit() local boolean PeonATK=IsUnitType(a,UNIT_TYPE_PEON) local boolean MainDEF=(d==s__PlayerStruct_main[(players[GetPlayerId((GetOwningPlayer(d)))])]) local boolean SameOWN=(GetOwningPlayer(d)==GetOwningPlayer(a)) local boolean LeaverDEF=(s__PlayerStruct_state[(players[GetPlayerId((GetOwningPlayer(d)))])]==STATE_LEFT) if IsSlayer(a)and GetUnitTypeId(d)=='U00E' then call UndoDamage(d,GetEventDamage()) endif if IsSlayer(a)and IsSlayer(d)and(not gameOver)and(not SameOWN)then if not BaseContainsPoint(GetPlayerBase(GetOwningPlayer(a)),GetUnitX(d),GetUnitX(d))then call UndoDamage(d,GetEventDamage()) endif endif if PeonATK and(SameOWN or LeaverDEF)and(not MainDEF)then call KillUnit(d) endif return false endfunction function stopAttack__OnAttack takes nothing returns boolean local unit a=GetAttacker() local unit d=GetTriggerUnit() local real x=GetUnitX(d) local real y=GetUnitY(d) local player pa=GetOwningPlayer(a) local player pd=GetOwningPlayer(d) local integer RANDOM=GetRandomInt(0,4) local integer UnitATK=GetUnitTypeId(a) local integer UnitDEF=GetUnitTypeId(d) local integer SideATK=s__PlayerStruct_side[(players[GetPlayerId((pa))])] local integer SideDEF=s__PlayerStruct_side[(players[GetPlayerId((pd))])] local boolean PeonATK=IsUnitType(a,UNIT_TYPE_PEON)and SideATK==SIDE_HUMAN local boolean MainATK=(a==s__PlayerStruct_main[(players[GetPlayerId((pa))])]) local boolean MainDEF=(d==s__PlayerStruct_main[(players[GetPlayerId((pd))])]) local boolean SameOWN=(pd==pa) local boolean LeaverDEF=((players[GetPlayerId((pd))])==STATE_LEFT) if IsSlayer(a)and UnitDEF=='U00E' then call IssueImmediateOrderById(a,851972) endif if PeonATK and SideDEF==SIDE_HUMAN and(not SameOWN)and(not LeaverDEF)then if BaseContainsPoint(GetPlayerBase(pa),x,y)then if IsUnitType(d,UNIT_TYPE_STRUCTURE)then call KillUnit(d) call DisplayTimedTextToPlayer(pd,0,0,10.,GetPlayerNameColored(pa)+"|cffffcc00 has destroyed your "+GetUnitName(d)+" in "+GetGenderHis(pa)+" base") else call MoveUnitToRect(d,gg_rct_poolMain) call DisplayTimedTextToPlayer(pd,0,0,10.,GetPlayerNameColored(pa)+"|cffffcc00 has ousted your "+GetUnitName(d)+" from "+GetGenderHis(pa)+" base") call IssueImmediateOrderById(a,851972) endif else call DisplayTimedTextToPlayer(pa,0,0,10.,"|CFFED1C24You can only use this unit to attack other players in your own base!|r") call IssueImmediateOrderById(a,851972) endif endif if PeonATK and(SameOWN or LeaverDEF)and(not MainDEF)then call AddDetection(d) endif if SideATK==SIDE_HUMAN and SideDEF==SIDE_HUMAN and MainDEF then call IssueImmediateOrderById(a,851972) if SameOWN then call DisplayTimedTextToPlayer(pa,0,0,10.,"|CFFFFFF00You cannot attack your Main Human!|r") else if RANDOM==0 then call DisplayTimedTextToPlayer(pa,0,0,10.,"|CFF6DCFF6Why do you want to kill your ally??|r") elseif RANDOM==1 then call DisplayTimedTextToPlayer(pa,0,0,10.,"|CFF6DCFF6If you're that desperate, go turn into a vampire then come back for the kill!|r") elseif RANDOM==2 then call DisplayTimedTextToPlayer(pa,0,0,10.,"|CFF6DCFF6One of the laws of the Warcraft is that you can attack your allies. One of the laws of Vampirism Fire is that you can't.|r") elseif RANDOM==3 then call DisplayTimedTextToPlayer(pa,0,0,10.,"|CFF6DCFF6Oh noes! Your attack button is stuck!|r") elseif RANDOM==4 then call DisplayTimedTextToPlayer(pa,0,0,10.,"|CFF6DCFF6How would you like it if "+GetPlayerNameColored(pd)+"|CFF6DCFF6 attacked you?|r") endif endif endif if(not PeonATK)and SideATK==SIDE_HUMAN and SideDEF==SIDE_HUMAN and(not SameOWN)and(not LeaverDEF)then if BaseContainsPoint(GetPlayerBase(pd),x,y)then call IssueImmediateOrderById(a,851972) call DisplayTimedTextToPlayer(pa,0,0,10.,"|CFFFF0000You can't attack "+GetPlayerNameColored(pd)+"|CFFFF0000's units in "+GetGenderHis(pd)+" own base!|r") endif endif if SideATK==SIDE_HUMAN and(not PeonATK)and((not IsSlayer(a))or(not gameOver))and IsSlayer(d)and(not SameOWN)then if not BaseContainsPoint(GetPlayerBase(pa),x,y)then call IssueImmediateOrderById(a,851972) call MoveSlayerInPool(d) endif endif if SideATK!=SIDE_HUMAN and SideDEF!=SIDE_HUMAN and(not SameOWN)then call IssueImmediateOrderById(a,851972) if RANDOM==0 then call DisplayTimedTextToPlayer(pa,0,0,10.,"|CFFC69C6DVampires need to attack Humans, not themselves!|r") elseif RANDOM==1 then call DisplayTimedTextToPlayer(pa,0,0,10.,"|CFFC69C6DYou didn't really think that was allowed, did you?|r") elseif RANDOM==2 then call DisplayTimedTextToPlayer(pa,0,0,10.,"|CFFC69C6DOh, you really do need to learn how to play..|r") elseif RANDOM==3 then call DisplayTimedTextToPlayer(pa,0,0,10.,"|CFFC69C6D\"More vampires=More gold for humans!\" - Oh Really? Well, tough luck.|r") elseif RANDOM==4 then call DisplayTimedTextToPlayer(pa,0,0,10.,"|CFFC69C6DYou're so tough you think you don't need allies? Well, you're wrong!|r") endif endif if UnitATK=='n00J' and UnitDEF!='hEng' and UnitDEF!='h021' then call IssueImmediateOrderById(a,851972) endif if SideATK!=SIDE_HUMAN and SideDEF==SIDE_HUMAN and MainDEF and UnitATK!='h015' and(not MainATK)then call IssueImmediateOrderById(a,851972) endif if(UnitATK=='u006' or UnitATK=='U00E')and(UnitDEF=='n001' or UnitDEF=='h00J')then call IssueImmediateOrderById(a,851972) endif if UnitATK=='n009' and(not IsHarvester(d))then call IssueImmediateOrderById(a,851972) endif if SameOWN and SideATK!=SIDE_HUMAN and MainDEF then call IssueImmediateOrderById(a,851972) call DisplayTimedTextToPlayer(pa,0,0,10.,"|CFFFFFF00You cannot attack your Main Vampire!|r") endif set a=null set d=null set pa=null set pd=null return false endfunction function InitTrig_stopAttack takes nothing returns nothing local trigger trg=XCreateTrigger() call TriggerRegisterAnyUnitEvent(trg,EVENT_PLAYER_UNIT_ATTACKED,null) call TriggerAddCondition(trg,Condition(function stopAttack__OnAttack)) set trg=null call TriggerAddCondition(dmgTrigger,Condition(function stopAttack__OnDamage)) endfunction function upgradeFix__Action takes nothing returns boolean local unit u=GetTriggerUnit() if GetUnitTypeId(u)=='hCmd' then call ShowUnit(u,false) call CreateUnit(GetOwningPlayer(u),'hCmd',GetUnitX(u),GetUnitY(u),GetUnitFacing(u)) call RemoveUnit(u) endif set u=null return false endfunction function InitTrig_upgradeFix takes nothing returns nothing local trigger trg=CreateTrigger() call TriggerRegisterAnyUnitEvent(trg,EVENT_PLAYER_UNIT_UPGRADE_FINISH,null) call TriggerAddCondition(trg,Condition(function upgradeFix__Action)) endfunction function itemSys__LimitItem takes integer id,integer muted,integer amount,integer ltype returns nothing set itemSys__lim_item[itemSys__num_lim]=id set itemSys__lim_type[itemSys__num_lim]=ltype set itemSys__lim_muted[itemSys__num_lim]=muted set itemSys__lim_amount[itemSys__num_lim]=amount set itemSys__num_lim=itemSys__num_lim+1 endfunction function itemSys__AddRecipe takes integer res,integer i0,integer i1,integer i2,integer i3,integer i4,integer i5 returns nothing set itemSys__recipe_res[itemSys__num_recipes]=res if itemSys__num_recipes==0 then set itemSys__recipe_ing_start[itemSys__num_recipes]=0 else set itemSys__recipe_ing_start[itemSys__num_recipes]=itemSys__recipe_ing_end[itemSys__num_recipes-1] endif set itemSys__recipe_ing_end[itemSys__num_recipes]=itemSys__recipe_ing_start[itemSys__num_recipes] if i0!=0 then set itemSys__recipe_ing[itemSys__recipe_ing_end[itemSys__num_recipes]]=i0 set itemSys__recipe_ing_end[itemSys__num_recipes]=itemSys__recipe_ing_end[itemSys__num_recipes]+1 endif if i1!=0 then set itemSys__recipe_ing[itemSys__recipe_ing_end[itemSys__num_recipes]]=i1 set itemSys__recipe_ing_end[itemSys__num_recipes]=itemSys__recipe_ing_end[itemSys__num_recipes]+1 endif if i2!=0 then set itemSys__recipe_ing[itemSys__recipe_ing_end[itemSys__num_recipes]]=i2 set itemSys__recipe_ing_end[itemSys__num_recipes]=itemSys__recipe_ing_end[itemSys__num_recipes]+1 endif if i3!=0 then set itemSys__recipe_ing[itemSys__recipe_ing_end[itemSys__num_recipes]]=i3 set itemSys__recipe_ing_end[itemSys__num_recipes]=itemSys__recipe_ing_end[itemSys__num_recipes]+1 endif if i4!=0 then set itemSys__recipe_ing[itemSys__recipe_ing_end[itemSys__num_recipes]]=i4 set itemSys__recipe_ing_end[itemSys__num_recipes]=itemSys__recipe_ing_end[itemSys__num_recipes]+1 endif if i5!=0 then set itemSys__recipe_ing[itemSys__recipe_ing_end[itemSys__num_recipes]]=i5 set itemSys__recipe_ing_end[itemSys__num_recipes]=itemSys__recipe_ing_end[itemSys__num_recipes]+1 endif set itemSys__num_recipes=itemSys__num_recipes+1 endfunction function itemSys__CheckRecipes takes unit u returns nothing local boolean array ingUsed local integer r=0 local integer i local integer j local boolean has loop exitwhen r>=itemSys__num_recipes set j=0 loop exitwhen j>=UnitInventorySize(u) set ingUsed[j]=false set j=j+1 endloop set i=itemSys__recipe_ing_start[r] set has=false loop exitwhen i>=itemSys__recipe_ing_end[r] set j=0 set has=false loop exitwhen j>=UnitInventorySize(u) if(not ingUsed[j])and GetItemTypeId(UnitItemInSlot(u,j))==itemSys__recipe_ing[i]then set has=true set ingUsed[j]=true set j=6 endif set j=j+1 endloop if not has then set i=itemSys__recipe_ing_end[r] endif set i=i+1 endloop if has then set j=0 loop exitwhen j>=UnitInventorySize(u) if ingUsed[j]then call RemoveItem(UnitItemInSlot(u,j)) endif set j=j+1 endloop call UnitAddItemById(u,itemSys__recipe_res[r]) set r=-1 endif set r=r+1 endloop endfunction function itemSys__OnTimer takes nothing returns nothing local integer i=0 local integer j local integer count local timer t=GetExpiredTimer() local integer hid=GetHandleId(t) local unit u=LoadUnitHandle(libHandleVars__ht,hid,HASH_ATTACH0) local integer uid=GetUnitTypeId(u) local integer id local integer amount=0 call DisableTrigger(itemSys__trg) call itemSys__CheckRecipes(u) loop exitwhen i>=itemSys__num_lim set j=0 set count=0 if itemSys__lim_type[i]==0 or(itemSys__lim_type[i]==1 and uid==DeathRevant__UnitId)or(itemSys__lim_type[i]==2 and uid=='E002')then set amount=itemSys__lim_amount[i] else set amount=10 endif loop exitwhen j>=UnitInventorySize(u) set id=GetItemTypeId(UnitItemInSlot(u,j)) if id==itemSys__lim_item[i]or id==itemSys__lim_muted[i]then if id==itemSys__lim_item[i]and count>=amount then call RemoveItem(UnitItemInSlot(u,j)) call UnitAddItemToSlotById(u,itemSys__lim_muted[i],j) elseif id==itemSys__lim_muted[i]and count<amount then call RemoveItem(UnitItemInSlot(u,j)) call UnitAddItemToSlotById(u,itemSys__lim_item[i],j) endif set count=count+1 endif set j=j+1 endloop set i=i+1 endloop call itemSys__CheckRecipes(u) call EnableTrigger(itemSys__trg) call PauseTimer(t) call DestroyTimer(t) set u=null endfunction function itemSys__OnManipulate takes nothing returns boolean local unit u local timer t if GetTriggerEventId()==EVENT_PLAYER_UNIT_PICKUP_ITEM or GetTriggerEventId()==EVENT_PLAYER_UNIT_DROP_ITEM then set u=GetManipulatingUnit() else set u=GetBuyingUnit() endif set t=CreateTimer() call SaveUnitHandle(libHandleVars__ht,GetHandleId(t),HASH_ATTACH0,u) call TimerStart(t,.01,false,function itemSys__OnTimer) set t=null return false endfunction function InitTrig_itemSys takes nothing returns nothing local integer i=0 set itemSys__trg=XCreateTrigger() loop exitwhen i>11 call TriggerRegisterPlayerUnitEvent(itemSys__trg,Player(i),EVENT_PLAYER_UNIT_PICKUP_ITEM,null) call TriggerRegisterPlayerUnitEvent(itemSys__trg,Player(i),EVENT_PLAYER_UNIT_DROP_ITEM,null) call TriggerRegisterPlayerUnitEvent(itemSys__trg,Player(i),EVENT_PLAYER_UNIT_SELL_ITEM,null) call TriggerRegisterPlayerUnitEvent(itemSys__trg,Player(i),EVENT_PLAYER_UNIT_PAWN_ITEM,null) set i=i+1 endloop call TriggerAddCondition(itemSys__trg,Condition(function itemSys__OnManipulate)) call itemSys__LimitItem('I00N','I00E',1,0) call itemSys__LimitItem('I01V','I01Y',1,0) call itemSys__LimitItem('I01W','I01Z',1,0) call itemSys__LimitItem('I00R','I01K',0,1) call itemSys__LimitItem('I017','I01L',0,1) call itemSys__LimitItem('I00V','I01M',0,1) call itemSys__LimitItem('clfm','I01N',0,1) call itemSys__LimitItem('ssil','I01O',0,1) call itemSys__LimitItem('I00M','I01R',0,1) call itemSys__LimitItem('I00M','I01R',0,1) call itemSys__LimitItem('GOHF','I01U',0,1) call itemSys__LimitItem('I00I','I022',0,1) call itemSys__LimitItem('I009','I01T',2,1) call itemSys__LimitItem('I003','I01P',0,2) call itemSys__LimitItem('I00K','I01Q',0,2) call itemSys__AddRecipe('I003','I00G','I00K','I00W',0,0,0) call itemSys__AddRecipe('I017','I00V','clfm','I00R',0,0,0) call itemSys__AddRecipe('I01X','I00Z','ssil','I00H',0,0,0) call itemSys__AddRecipe('I01V','I00N','I00N',0,0,0,0) call itemSys__AddRecipe('I01W','I01V','I00N',0,0,0,0) endfunction function Critical__GetChance takes integer level returns real return criticalChance[level] return .0 endfunction function Critical__GetDamage takes integer level returns real return criticalDamage[level] return .0 endfunction function s__CriticalData_onDestroy takes integer this returns nothing set s__UnitData_crit[(GetUnitUserData((s__CriticalData_u[this])))]=0 call FlushChildHashtable(libHandleVars__ht,GetHandleId((s__CriticalData_t[this]))) call PauseTimer(s__CriticalData_t[this]) call DestroyTimer(s__CriticalData_t[this]) set s__CriticalData_t[this]=null set s__CriticalData_u[this]=null set s__CriticalData_target[this]=null endfunction function s__CriticalData_deallocate takes integer this returns nothing if this==null then return elseif(si__CriticalData_V[this]!=-1)then return endif call s__CriticalData_onDestroy(this) set si__CriticalData_V[this]=si__CriticalData_F set si__CriticalData_F=this endfunction function Critical__OnExpire takes nothing returns nothing local timer t=GetExpiredTimer() local integer cd=(LoadInteger(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH0))) call s__CriticalData_deallocate(cd) set t=null endfunction function Critical__OnDamage takes nothing returns boolean local unit u=GetTriggerUnit() local unit d=GetEventDamageSource() local integer ud local integer cd=0 local integer level local real damage=GetEventDamage() local real hp local texttag tag local real finalDamage if GetEventDamage()>.5 and GetUnitAbilityLevel(d,Critical__AbilID)>0 and IsUnitEnemy(u,GetOwningPlayer(d))then set ud=GetUnitUserData(d) set cd=s__UnitData_crit[ud] if cd!=0 and s__CriticalData_target[cd]==u then call s__CriticalData_deallocate(cd) set level=GetUnitAbilityLevel(d,Critical__AbilID) set hp=GetUnitState(u,UNIT_STATE_LIFE) if GetRandomReal(0,100)<Critical__GetChance(level)then call DisableTrigger(dmgTrigger) set finalDamage=hp*Critical__GetDamage(level) call UnitDamageTarget(d,u,finalDamage,true,true,ATTACK_TYPE_HERO,DAMAGE_TYPE_MAGIC,WEAPON_TYPE_WHOKNOWS) call EnableTrigger(dmgTrigger) set tag=CreateTextTagUnitBJ("|cffFF0000"+I2S(R2I(finalDamage))+"|r",u,0,11,100,100,100,0) call SetTextTagVelocity(tag,0,0.04) call SetTextTagPermanent(tag,false) call SetTextTagFadepoint(tag,4.00) call SetTextTagLifespan(tag,3.00) call SetTextTagVisibility(tag,true) endif endif endif set u=null set d=null set tag=null return false endfunction function Critical__OnAttack takes nothing returns boolean local unit u=GetTriggerUnit() local unit d=GetAttacker() local integer cd if GetUnitAbilityLevel(d,Critical__AbilID)>0 and IsUnitEnemy(u,GetOwningPlayer(d))then set cd=s__UnitData_crit[(GetUnitUserData((d)))] if cd==0 then set cd=s__CriticalData__allocate() set s__CriticalData_t[cd]=CreateTimer() call SaveInteger(libHandleVars__ht,GetHandleId((s__CriticalData_t[cd])),(HASH_ATTACH0),(cd)) set s__CriticalData_u[cd]=d set s__UnitData_crit[(GetUnitUserData((d)))]=cd endif set s__CriticalData_target[cd]=u call TimerStart(s__CriticalData_t[cd],1.,false,function Critical__OnExpire) call AddDetection(u) endif set u=null set d=null return false endfunction function InitTrig_Critical takes nothing returns nothing local trigger trg=XCreateTrigger() set criticalChance[1]=0.5 set criticalChance[2]=1 set criticalChance[3]=1.5 set criticalChance[4]=2 set criticalChance[5]=2.5 set criticalChance[6]=3 set criticalChance[7]=3.5 set criticalChance[8]=4 set criticalChance[9]=4.5 set criticalChance[10]=5 set criticalDamage[1]=0.03 set criticalDamage[2]=0.03 set criticalDamage[3]=0.035 set criticalDamage[4]=0.035 set criticalDamage[5]=0.04 set criticalDamage[6]=0.04 set criticalDamage[7]=0.045 set criticalDamage[8]=0.045 set criticalDamage[9]=0.05 set criticalDamage[10]=0.05 call TriggerRegisterAnyUnitEventBJ(trg,EVENT_PLAYER_UNIT_ATTACKED) call TriggerAddCondition(trg,Condition(function Critical__OnAttack)) call TriggerAddCondition(dmgTrigger,Condition(function Critical__OnDamage)) endfunction function s__CalciteData__allocate takes nothing returns integer local integer this=si__CalciteData_F if(this!=0)then set si__CalciteData_F=si__CalciteData_V[this] else set si__CalciteData_I=si__CalciteData_I+1 set this=si__CalciteData_I endif if(this>8190)then return 0 endif set si__CalciteData_V[this]=-1 return this endfunction function s__CalciteData_onDestroy takes integer this returns nothing set s__UnitData_calcite[(GetUnitUserData((s__CalciteData_u[this])))]=0 call UnitRemoveAbility(s__CalciteData_u[this],CalciteOutpost__EffectID) call FlushChildHashtable(libHandleVars__ht,GetHandleId((s__CalciteData_t[this]))) call PauseTimer(s__CalciteData_t[this]) call DestroyTimer(s__CalciteData_t[this]) set s__CalciteData_t[this]=null set s__CalciteData_u[this]=null set s__CalciteData_target[this]=null endfunction function s__CalciteData_deallocate takes integer this returns nothing if this==null then return elseif(si__CalciteData_V[this]!=-1)then return endif call s__CalciteData_onDestroy(this) set si__CalciteData_V[this]=si__CalciteData_F set si__CalciteData_F=this endfunction function CalciteOutpost__OnExpire takes nothing returns nothing local timer t=GetExpiredTimer() local integer cd=(LoadInteger(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH0))) call s__CalciteData_deallocate(cd) set t=null endfunction function CalciteOutpost__OnDamage takes nothing returns boolean local unit u=GetTriggerUnit() local unit d=GetEventDamageSource() local integer ud local integer cd=0 if GetEventDamage()>.5 and GetUnitAbilityLevel(d,CalciteOutpost__PassiveID)>0 and IsUnitEnemy(u,GetOwningPlayer(d))then set ud=GetUnitUserData(d) set cd=s__UnitData_calcite[ud] if cd==0 then set cd=s__CalciteData__allocate() set s__CalciteData_t[cd]=CreateTimer() call SaveInteger(libHandleVars__ht,GetHandleId((s__CalciteData_t[cd])),(HASH_ATTACH0),(cd)) set s__CalciteData_u[cd]=d set s__CalciteData_target[cd]=u set s__CalciteData_amount[cd]=0 set s__UnitData_calcite[ud]=cd endif call TimerStart(s__CalciteData_t[cd],10.,false,function CalciteOutpost__OnExpire) if s__CalciteData_target[cd]==u then set s__CalciteData_amount[cd]=s__CalciteData_amount[cd]+1 else set s__CalciteData_amount[cd]=1 endif if s__CalciteData_amount[cd]>CalciteOutpost__MaxStack then set s__CalciteData_amount[cd]=CalciteOutpost__MaxStack endif call UnitAddAbility(d,CalciteOutpost__EffectID) call UnitMakeAbilityPermanent(d,true,CalciteOutpost__EffectID) call SetUnitAbilityLevel(d,CalciteOutpost__EffectID,s__CalciteData_amount[cd]) endif set u=null set d=null return false endfunction function CalciteOutpost__OnAttack takes nothing returns boolean local unit u=GetTriggerUnit() local unit d=GetAttacker() local integer cd if GetUnitAbilityLevel(d,CalciteOutpost__PassiveID)>0 and IsUnitEnemy(u,GetOwningPlayer(d))then call AddDetection(u) set cd=s__UnitData_calcite[(GetUnitUserData((d)))] if cd!=0 and s__CalciteData_target[cd]!=u then call s__CalciteData_deallocate(cd) endif endif set u=null set d=null return false endfunction function InitTrig_CalciteOutpost takes nothing returns nothing local trigger trg=XCreateTrigger() call TriggerRegisterAnyUnitEventBJ(trg,EVENT_PLAYER_UNIT_ATTACKED) call TriggerAddCondition(trg,Condition(function CalciteOutpost__OnAttack)) call TriggerAddCondition(dmgTrigger,Condition(function CalciteOutpost__OnDamage)) endfunction function GetRegen takes integer u returns real if u=='hBgm' or u=='h004' or u=='h00O' or u=='h019' or u=='h00P' or u=='n008' or u=='hTWb' then return 500. elseif u=='hCmd' then return 200. elseif u=='h00N' or u=='h00F' then return 100. elseif u=='u003' or u=='u000' then return 150. elseif u=='h003' or u=='h006' then return 25. elseif u=='h00J' or u=='h00U' or u=='o006' or u=='hTMb' or u=='hTFb' then return 5. elseif u=='h001' or u=='o001' or u=='o004' then return 1. elseif u=='h00Z' then return 30. elseif u=='h01R' then return 40. elseif u=='h00E' or u=='h00L' or u=='h00D' or u=='hHBT' or u=='h00S' or u=='h00M' or u=='h00H' or u=='h01U' then return 50. elseif u=='h005' or u=='u00I' or u=='hTFs' or u=='n006' then return 20. elseif u=='h000' or u=='hWhp' then return 10. endif return .0 endfunction function Wyrm__UpdateFrozen takes nothing returns nothing local integer i=0 local integer ud loop exitwhen i>=Wyrm__nfrozen set ud=GetUnitUserData(Wyrm__frozen[i]) set s__UnitData_freezeLeft[ud]=s__UnitData_freezeLeft[ud]-Wyrm__C_TIME if s__UnitData_freezeLeft[ud]>0 then if GetWidgetLife(Wyrm__frozen[i])>Wyrm__fregen[i]+5 then call SetWidgetLife(Wyrm__frozen[i],GetWidgetLife(Wyrm__frozen[i])-Wyrm__fregen[i]) endif set i=i+1 else set s__UnitData_freezeLeft[ud]=-1 set Wyrm__nfrozen=Wyrm__nfrozen-1 set Wyrm__frozen[i]=Wyrm__frozen[Wyrm__nfrozen] set Wyrm__fregen[i]=Wyrm__fregen[Wyrm__nfrozen] set Wyrm__frozen[Wyrm__nfrozen]=null endif endloop if Wyrm__nfrozen==0 then call PauseTimer(Wyrm__ftimer) endif endfunction function Wyrm__OnDamage takes nothing returns boolean local unit u=GetTriggerUnit() local unit d=GetEventDamageSource() local integer ud if GetEventDamage()>.5 and GetUnitTypeId(u)==Wyrm__WYRMID and GetUnitTypeId(d)=='o006' then call DisableTrigger(dmgTrigger) call UnitDamageTarget(d,u,GetEventDamage(),true,true,ATTACK_TYPE_HERO,DAMAGE_TYPE_MAGIC,WEAPON_TYPE_WHOKNOWS) call EnableTrigger(dmgTrigger) endif if GetEventDamage()>.5 and GetUnitTypeId(d)==Wyrm__WYRMID and GetPlayerTechCount(GetOwningPlayer(d),'Ruwb',false)>0 then set Wyrm__fregen[Wyrm__nfrozen]=GetRegen(GetUnitTypeId(u)) if Wyrm__fregen[Wyrm__nfrozen]>.5 then call DummySpellTarget(GetOwningPlayer(d),u,'Aure',"slow") set ud=GetUnitUserData(u) if s__UnitData_freezeLeft[ud]<-.5 then set Wyrm__frozen[Wyrm__nfrozen]=u set Wyrm__fregen[Wyrm__nfrozen]=Wyrm__fregen[Wyrm__nfrozen]*Wyrm__C_TIME set Wyrm__nfrozen=Wyrm__nfrozen+1 endif set s__UnitData_freezeLeft[ud]=5. if Wyrm__nfrozen==1 then call TimerStart(Wyrm__ftimer,Wyrm__C_TIME,true,function Wyrm__UpdateFrozen) endif endif endif set u=null set d=null return false endfunction function Wyrm__OnAttack takes nothing returns boolean local unit u=GetTriggerUnit() local unit d=GetAttacker() if GetUnitTypeId(d)==Wyrm__WYRMID and IsUnitType(u,UNIT_TYPE_STRUCTURE)and GetPlayerTechCount(GetOwningPlayer(d),'Ruwb',false)>0 then call AddDetection(u) endif set u=null set d=null return false endfunction function Wyrm__OnTrain takes nothing returns boolean local unit tu=GetTrainedUnit() local integer bp=GetPlayerId(GetOwningPlayer(GetTriggerUnit())) if GetUnitTypeId(tu)==Wyrm__WYRMID then call AddDetection(tu) set WyrmUnit[bp]=tu call SetPlayerTechMaxAllowed(Player(bp),'Rufb',1) call SetPlayerTechMaxAllowed(Player(bp),'Ruwb',1) call SetPlayerTechMaxAllowed(Player(bp),'R00K',1) elseif GetUnitTypeId(tu)==Wyrm__FAKEWYRMID then call ShowUnit(tu,false) call ReviveHero(WyrmUnit[bp],GetUnitX(tu),GetUnitY(tu),true) call RemoveUnit(tu) call SetPlayerTechMaxAllowed(Player(bp),Wyrm__FAKEWYRMID,0) endif set tu=null return false endfunction function Wyrm__OnRevivable takes nothing returns boolean local integer bp=GetPlayerId(GetOwningPlayer(GetTriggerUnit())) if WyrmUnit[bp]!=null then call SetPlayerTechMaxAllowed(Player(bp),Wyrm__FAKEWYRMID,1) endif return false endfunction function InitTrig_Wyrm takes nothing returns nothing local trigger trg=XCreateTrigger() call TriggerRegisterAnyUnitEvent(trg,EVENT_PLAYER_UNIT_TRAIN_FINISH,null) call TriggerAddCondition(trg,Condition(function Wyrm__OnTrain)) set trg=XCreateTrigger() call TriggerRegisterAnyUnitEvent(trg,EVENT_PLAYER_HERO_REVIVABLE,null) call TriggerAddCondition(trg,Condition(function Wyrm__OnRevivable)) set trg=XCreateTrigger() call TriggerRegisterAnyUnitEvent(trg,EVENT_PLAYER_UNIT_ATTACKED,null) call TriggerRegisterAnyUnitEvent(trg,EVENT_PLAYER_UNIT_ATTACKED,null) call TriggerAddCondition(trg,Condition(function Wyrm__OnAttack)) call TriggerAddCondition(dmgTrigger,Condition(function Wyrm__OnDamage)) endfunction function s__MultiplierData__allocate takes nothing returns integer local integer this=si__MultiplierData_F if(this!=0)then set si__MultiplierData_F=si__MultiplierData_V[this] else set si__MultiplierData_I=si__MultiplierData_I+1 set this=si__MultiplierData_I endif if(this>8190)then return 0 endif set si__MultiplierData_V[this]=-1 return this endfunction function s__MultiplierData_deallocate takes integer this returns nothing local integer i=0 if this==null then return elseif(si__MultiplierData_V[this]!=-1)then return endif set s__UnitData_multiplier[(GetUnitUserData((s__MultiplierData_u[this])))]=0 loop exitwhen i>16 call UnitRemoveAbility(s__MultiplierData_u[this],Multiplier__abils[i]) call UnitRemoveAbility(s__MultiplierData_u[this],Multiplier__s_abils[i]) set i=i+1 endloop call FlushChildHashtable(libHandleVars__ht,GetHandleId(s__MultiplierData_t[this])) call PauseTimer(s__MultiplierData_t[this]) call DestroyTimer(s__MultiplierData_t[this]) set s__MultiplierData_t[this]=null set s__MultiplierData_u[this]=null set s__MultiplierData_target[this]=null set si__MultiplierData_V[this]=si__MultiplierData_F set si__MultiplierData_F=this endfunction function Multiplier__OnExpire takes nothing returns nothing local timer t=GetExpiredTimer() local integer cd=(LoadInteger(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH0))) call s__MultiplierData_deallocate(cd) set t=null endfunction function Multiplier__OnDamage takes nothing returns boolean local unit u=GetTriggerUnit() local unit d=GetEventDamageSource() local integer ud local integer cd=0 local integer i=9 local integer c=512 local integer r if GetEventDamage()>.5 and(GetUnitAbilityLevel(d,'A02U')>0 or GetUnitAbilityLevel(d,'A040')>0)and IsUnitEnemy(u,GetOwningPlayer(d))then set ud=GetUnitUserData(d) set cd=s__UnitData_multiplier[ud] if(GetUnitTypeId(d)=='e004' or GetUnitTypeId(d)=='e005')and not IsWall(u)then if cd>0 then call s__MultiplierData_deallocate(cd) endif return false endif if cd==0 then set cd=s__MultiplierData__allocate() set s__MultiplierData_t[cd]=CreateTimer() call SaveInteger(libHandleVars__ht,GetHandleId((s__MultiplierData_t[cd])),(HASH_ATTACH0),(cd)) set s__MultiplierData_u[cd]=d set s__MultiplierData_target[cd]=u set s__MultiplierData_amount[cd]=0 set s__UnitData_multiplier[ud]=cd endif call TimerStart(s__MultiplierData_t[cd],5.,false,function Multiplier__OnExpire) if s__MultiplierData_target[cd]==u then set s__MultiplierData_amount[cd]=s__MultiplierData_amount[cd]+1 else set s__MultiplierData_amount[cd]=1 endif set r=s__MultiplierData_amount[cd] if GetUnitAbilityLevel(d,'A040')>0 then loop exitwhen i<0 if c<=r then set r=r-c call UnitAddAbility(d,Multiplier__s_abils[i]) call UnitMakeAbilityPermanent(d,true,Multiplier__s_abils[i]) else call UnitRemoveAbility(d,Multiplier__s_abils[i]) endif set c=c/2 set i=i-1 endloop else loop exitwhen i<0 if c<=r then set r=r-c call UnitAddAbility(d,Multiplier__abils[i]) call UnitMakeAbilityPermanent(d,true,Multiplier__abils[i]) else call UnitRemoveAbility(d,Multiplier__abils[i]) endif set c=c/2 set i=i-1 endloop endif endif set u=null set d=null return false endfunction function Multiplier_OnAttack takes nothing returns boolean local unit u=GetTriggerUnit() local unit d=GetAttacker() local integer cd if(GetUnitAbilityLevel(d,'A02U')>0 or GetUnitAbilityLevel(d,'A040')>0)and IsUnitEnemy(u,GetOwningPlayer(d))then call AddDetection(u) set cd=s__UnitData_multiplier[(GetUnitUserData((d)))] if cd !=0 and s__MultiplierData_target[cd]!=u then call s__MultiplierData_deallocate(cd) endif endif set u=null set d=null return false endfunction function Multiplier__OnInit takes nothing returns nothing local trigger trg=XCreateTrigger() call TriggerRegisterAnyUnitEvent(trg,EVENT_PLAYER_UNIT_ATTACKED,null) call TriggerAddCondition(trg,Condition(function Multiplier_OnAttack)) call TriggerAddCondition(dmgTrigger,Condition(function Multiplier__OnDamage)) set Multiplier__abils[0]='A02O' set Multiplier__abils[1]='A02N' set Multiplier__abils[2]='A02M' set Multiplier__abils[3]='A02F' set Multiplier__abils[4]='A02P' set Multiplier__abils[5]='A02Q' set Multiplier__abils[6]='A02R' set Multiplier__abils[7]='A02L' set Multiplier__abils[8]='A02S' set Multiplier__abils[9]='A02T' set Multiplier__abils[10]='A03L' set Multiplier__abils[11]='A03M' set Multiplier__abils[12]='A03Z' set Multiplier__s_abils[0]='A03N' set Multiplier__s_abils[1]='A03O' set Multiplier__s_abils[2]='A03P' set Multiplier__s_abils[3]='A03Q' set Multiplier__s_abils[4]='A03R' set Multiplier__s_abils[5]='A03S' set Multiplier__s_abils[6]='A03T' set Multiplier__s_abils[7]='A03V' set Multiplier__s_abils[8]='A03U' set Multiplier__s_abils[9]='A03W' set Multiplier__s_abils[10]='A03X' set Multiplier__s_abils[11]='A03Y' set Multiplier__s_abils[12]='A041' endfunction function s__BloodData__allocate takes nothing returns integer local integer this=si__BloodData_F if(this!=0)then set si__BloodData_F=si__BloodData_V[this] else set si__BloodData_I=si__BloodData_I+1 set this=si__BloodData_I endif if(this>8190)then return 0 endif set si__BloodData_V[this]=-1 return this endfunction function s__BloodData_deallocate takes integer this returns nothing if this==null then return elseif(si__BloodData_V[this]!=-1)then return endif set si__BloodData_V[this]=si__BloodData_F set si__BloodData_F=this endfunction function BloodTower__OnExpire takes nothing returns nothing local timer t=GetExpiredTimer() local integer d=(LoadInteger(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH0))) local integer i=0 loop exitwhen i>15 call UnitRemoveAbility(s__BloodData_u[d],BloodTower__abils[i]) set i=i+1 endloop set s__UnitData_blood[(GetUnitUserData((s__BloodData_u[d])))]=0 set s__BloodData_t[d]=null set s__BloodData_u[d]=null call s__BloodData_deallocate(d) call FlushChildHashtable(libHandleVars__ht,GetHandleId((t))) call PauseTimer(t) call DestroyTimer(t) set t=null endfunction function BloodTower__OnDamage takes nothing returns boolean local unit u=GetTriggerUnit() local unit d=GetEventDamageSource() local integer ud local integer bd=0 local integer i=15 local integer c=32768 local integer r if GetEventDamage()>.5 and GetUnitAbilityLevel(d,'A00L')>0 and IsUnitEnemy(u,GetOwningPlayer(d))then set ud=GetUnitUserData(u) set bd=s__UnitData_blood[ud] if bd==0 then set bd=s__BloodData__allocate() set s__BloodData_t[bd]=CreateTimer() call SaveInteger(libHandleVars__ht,GetHandleId((s__BloodData_t[bd])),(HASH_ATTACH0),(bd)) set s__BloodData_u[bd]=u set s__BloodData_amount[bd]=0 set s__UnitData_blood[ud]=bd endif call TimerStart(s__BloodData_t[bd],5.,false,function BloodTower__OnExpire) set s__BloodData_amount[bd]=s__BloodData_amount[bd]+1 if s__BloodData_amount[bd]>50000 then set s__BloodData_amount[bd]=50000 endif set r=s__BloodData_amount[bd] loop exitwhen i<0 if c<=r then set r=r-c call UnitAddAbility(s__BloodData_u[bd],BloodTower__abils[i]) call UnitMakeAbilityPermanent(s__BloodData_u[bd],true,BloodTower__abils[i]) else call UnitRemoveAbility(s__BloodData_u[bd],BloodTower__abils[i]) endif set c=c/2 set i=i-1 endloop endif set u=null set d=null return false endfunction function BloodTower__OnAttack takes nothing returns boolean local unit u=GetTriggerUnit() local unit d=GetAttacker() if GetUnitAbilityLevel(d,'A00L')>0 and IsUnitEnemy(u,GetOwningPlayer(d))then call AddDetection(u) endif set u=null set d=null return false endfunction function BloodTower__OnInit takes nothing returns nothing local trigger trg=XCreateTrigger() call TriggerRegisterAnyUnitEvent(trg,EVENT_PLAYER_UNIT_ATTACKED,null) call TriggerAddCondition(trg,Condition(function BloodTower__OnAttack)) call TriggerAddCondition(dmgTrigger,Condition(function BloodTower__OnDamage)) set BloodTower__abils[0]='ZxA0' set BloodTower__abils[1]='ZxA1' set BloodTower__abils[2]='ZxA2' set BloodTower__abils[3]='ZxA3' set BloodTower__abils[4]='ZxA4' set BloodTower__abils[5]='ZxA5' set BloodTower__abils[6]='ZxA6' set BloodTower__abils[7]='ZxA7' set BloodTower__abils[8]='ZxA8' set BloodTower__abils[9]='ZxA9' set BloodTower__abils[10]='ZxAA' set BloodTower__abils[11]='ZxAB' set BloodTower__abils[12]='ZxAC' set BloodTower__abils[13]='ZxAD' set BloodTower__abils[14]='ZxAE' set BloodTower__abils[15]='ZxAF' call SaveInteger(armor__tht,'h001',HASH_ATTACH0,10) call SaveInteger(armor__tht,'h000',HASH_ATTACH0,20) call SaveInteger(armor__tht,'h003',HASH_ATTACH0,30) call SaveInteger(armor__tht,'h005',HASH_ATTACH0,55) call SaveInteger(armor__tht,'h006',HASH_ATTACH0,80) call SaveInteger(armor__tht,'h00Z',HASH_ATTACH0,90) call SaveInteger(armor__tht,'h01R',HASH_ATTACH0,100) call SaveInteger(armor__tht,'h00E',HASH_ATTACH0,110) call SaveInteger(armor__tht,'h00F',HASH_ATTACH0,160) call SaveInteger(armor__tht,'h00P',HASH_ATTACH0,450) call SaveInteger(armor__tht,'h001',HASH_ATTACH1,10) call SaveInteger(armor__tht,'h000',HASH_ATTACH1,15) call SaveInteger(armor__tht,'h003',HASH_ATTACH1,20) call SaveInteger(armor__tht,'h005',HASH_ATTACH1,25) call SaveInteger(armor__tht,'h006',HASH_ATTACH1,25) call SaveInteger(armor__tht,'h00Z',HASH_ATTACH1,25) call SaveInteger(armor__tht,'h01R',HASH_ATTACH1,25) call SaveInteger(armor__tht,'h00E',HASH_ATTACH1,30) call SaveInteger(armor__tht,'h00F',HASH_ATTACH1,35) call SaveInteger(armor__tht,'h00P',HASH_ATTACH1,40) endfunction function autoharvest__OnTimer takes nothing returns nothing loop exitwhen autoharvest__ahCount==0 set autoharvest__ahCount=autoharvest__ahCount-1 if GetUnitCurrentOrder(autoharvest__ahUnits[autoharvest__ahCount])==0 or GetUnitCurrentOrder(autoharvest__ahUnits[autoharvest__ahCount])==851972then call IssueImmediateOrderById(autoharvest__ahUnits[autoharvest__ahCount],852022) endif endloop endfunction function autoharvest__OnTrain takes nothing returns boolean local unit u=GetTrainedUnit() if IsHarvester(u)then set autoharvest__ahUnits[autoharvest__ahCount]=u set autoharvest__ahCount=autoharvest__ahCount+1 call TimerStart(autoharvest__ahTimer,.1,false,function autoharvest__OnTimer) endif set u=null return false endfunction function InitTrig_autoharvest takes nothing returns nothing local trigger trg=XCreateTrigger() call TriggerRegisterAnyUnitEvent(trg,EVENT_PLAYER_UNIT_TRAIN_FINISH,null) call TriggerAddCondition(trg,Condition(function autoharvest__OnTrain)) set trg=null endfunction function itemAcquire__SphereStats takes nothing returns nothing local integer i=0 loop exitwhen i>11 if s__PlayerStruct_side[players[i]]!=SIDE_HUMAN and s__PlayerStruct_state[players[i]]==STATE_PLAYING and s__PlayerStruct_main[players[i]]!=null then call SetHeroStr(s__PlayerStruct_main[players[i]],GetHeroStr(s__PlayerStruct_main[players[i]],false)+5,true) call SetHeroAgi(s__PlayerStruct_main[players[i]],GetHeroAgi(s__PlayerStruct_main[players[i]],false)+5,true) call SetHeroInt(s__PlayerStruct_main[players[i]],GetHeroInt(s__PlayerStruct_main[players[i]],false)+5,true) endif set i=i+1 endloop endfunction function itemAcquire__OnAcquire takes nothing returns boolean local item it=GetManipulatedItem() local item it2 local integer iid=GetItemTypeId(it) local unit mu=GetManipulatingUnit() local player pp=GetOwningPlayer(mu) local integer i local timer t local player op if GetUnitTypeId(mu)=='n003' then set it=null set pp=null set op=null set it2=null set mu=null return false endif if iid=='I01B' or iid=='I01C' then if GetUnitAbilityLevel(mu,'Bcrs')>0 then set it2=CreateItem(iid,(LoadReal(libHandleVars__ht,GetHandleId((it)),(HASH_ATTACH0))),(LoadReal(libHandleVars__ht,GetHandleId((it)),(HASH_ATTACH1)))) call SetItemPlayer(it2,GetItemPlayer(it),false) call SaveReal(libHandleVars__ht,GetHandleId((it2)),(HASH_ATTACH0),(((LoadReal(libHandleVars__ht,GetHandleId((it)),(HASH_ATTACH0))))*1.)) call SaveReal(libHandleVars__ht,GetHandleId((it2)),(HASH_ATTACH1),(((LoadReal(libHandleVars__ht,GetHandleId((it)),(HASH_ATTACH1))))*1.)) set it2=null else if iid=='I01B' then set i=1 elseif iid=='I01C' then set i=3 endif call AddResources(pp,i,0) set op=GetItemPlayer(it) if op!=null and IsPlayerEnemy(pp,op)then set s__PlayerStruct_vampireGoldLeaks[(players[GetPlayerId((op))])]=s__PlayerStruct_vampireGoldLeaks[(players[GetPlayerId((op))])]+i call UpdateMultiboardPlayer(GetPlayerId(op)) call toHumans(3,GetPlayerNameColored(op)+" just leaked "+I2S(i)+"g to "+GetPlayerNameColored(pp)) call toVamps(3,GetPlayerNameColored(op)+" just leaked "+I2S(i)+"g") endif if s__PlayerStruct_side[(players[GetPlayerId((pp))])]!=SIDE_HUMAN then set s__PlayerStruct_vampireGold[(players[GetPlayerId((pp))])]=s__PlayerStruct_vampireGold[(players[GetPlayerId((pp))])]+i endif call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Items\\ResourceItems\\ResourceEffectTarget.mdl",GetUnitX(mu),GetUnitY(mu))) endif call FlushChildHashtable(libHandleVars__ht,GetHandleId((it))) elseif iid=='I012' or iid=='I01D' then if iid=='I012' then set i=1 elseif iid=='I01D' then set i=3 endif set op=GetItemPlayer(it) if op!=null and IsPlayerEnemy(pp,op)then set s__PlayerStruct_vampireWoodLeaks[(players[GetPlayerId((op))])]=s__PlayerStruct_vampireWoodLeaks[(players[GetPlayerId((op))])]+i call UpdateMultiboardPlayer(GetPlayerId(op)) call AddResources(pp,0,i*3000) call toHumans(3,GetPlayerNameColored(op)+" just leaked "+I2S(i*3)+"k wood to "+GetPlayerNameColored(pp)) call toVamps(3,GetPlayerNameColored(op)+" just leaked "+I2S(i*3)+"k wood") endif if s__PlayerStruct_side[(players[GetPlayerId((pp))])]!=SIDE_HUMAN then set s__PlayerStruct_vampireGold[(players[GetPlayerId((pp))])]=s__PlayerStruct_vampireGold[(players[GetPlayerId((pp))])]+i call AddResources(pp,i,0) endif call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Items\\ResourceItems\\ResourceEffectTarget.mdl",GetUnitX(mu),GetUnitY(mu))) call FlushChildHashtable(libHandleVars__ht,GetHandleId((it))) endif if s__PlayerStruct_side[(players[GetPlayerId((pp))])]!=SIDE_HUMAN then if iid=='I00F' or iid=='I000' or iid=='skul' then call RemoveItem(it) call CreateItem(iid,GetUnitX(mu),GetUnitY(mu)) elseif iid=='I01G' then set i=0 loop exitwhen i>UnitInventorySize(mu) set it2=UnitItemInSlot(mu,i) if it2!=null and GetItemTypeId(it2)=='I01G' and it!=it2 then call SetItemCharges(it2,GetItemCharges(it2)+GetItemCharges(it)) call RemoveItem(it) set i=6 endif set i=i+1 endloop elseif iid=='I00B' then if ShowMessage(iid)then set t=CreateTimer() call TimerStart(t,15.,true,function itemAcquire__SphereStats) set t=null endif elseif iid=='I00R' then elseif iid=='I018' or iid=='I020' then call RemoveItem(it) call InterfaceError(pp,"You do not need to purchase a recipe for this item") endif elseif s__PlayerStruct_side[(players[GetPlayerId((pp))])]==SIDE_HUMAN then if iid=='ankh' or iid=='I00Y' then call RemoveItem(it) call CreateItem(iid,GetUnitX(mu),GetUnitY(mu)) elseif iid=='I000' then call SetHeroLevel(mu,GetHeroLevel(mu)+5,true) call RemoveItem(it) elseif iid=='skul' then call SetHeroLevel(mu,GetHeroLevel(mu)+2,true) call RemoveItem(it) endif endif set it=null set pp=null set op=null set it2=null set mu=null return false endfunction function InitTrig_itemAcquire takes nothing returns nothing local trigger trg=XCreateTrigger() call TriggerRegisterAnyUnitEvent(trg,EVENT_PLAYER_UNIT_PICKUP_ITEM,null) call TriggerAddCondition(trg,Condition(function itemAcquire__OnAcquire)) set trg=null endfunction function selectVampires__OnSell takes nothing returns boolean local unit u=GetSoldUnit() local integer i=0 local integer j=0 loop exitwhen i>numVampTypes if GetUnitTypeId(u)==vampTypes[i]then loop exitwhen j>numVampTypes call SetPlayerTechMaxAllowed(GetOwningPlayer(u),vampTypes[j],0) set j=j+1 endloop call MoveUnitToRect(u,gg_rct_spawnVampires) call SetHeroLevel(u,3,false) call SetUnitVertexColor(u,32,0,0,224) call UnitAddItemById(u,'I01I') call ShowUnit(u,false) set s__PlayerStruct_main[(players[GetPlayerId((GetOwningPlayer(u)))])]=u endif set i=i+1 endloop set u=null return false endfunction function InitTrig_selectVampires takes nothing returns nothing local trigger trg=XCreateTrigger() call TriggerRegisterAnyUnitEvent(trg,EVENT_PLAYER_UNIT_SELL,null) call TriggerAddCondition(trg,Condition(function selectVampires__OnSell)) set trg=null endfunction function shareControl__UpdateShares takes nothing returns nothing local integer i=0 local integer j=0 loop exitwhen i>11 set j=0 loop exitwhen j>11 if GetPlayerAlliance(Player(i),Player(j),ALLIANCE_SHARED_CONTROL)then call SetPlayerAlliance(Player(i),Player(j),ALLIANCE_SHARED_ADVANCED_CONTROL,true) else call SetPlayerAlliance(Player(i),Player(j),ALLIANCE_SHARED_ADVANCED_CONTROL,false) endif set j=j+1 endloop set i=i+1 endloop call UpdateMultiboard() endfunction function shareControl__OnControl takes nothing returns boolean call TimerStart(shareControl__tim,.5,false,function shareControl__UpdateShares) return false endfunction function InitTrig_shareControl takes nothing returns nothing local integer i=0 local trigger trg=XCreateTrigger() loop exitwhen i>11 call TriggerRegisterPlayerAllianceChange(trg,Player(i),ALLIANCE_SHARED_CONTROL) set i=i+1 endloop call TriggerAddCondition(trg,Condition(function shareControl__OnControl)) set trg=null endfunction function unitCasts__RegrowTree takes nothing returns nothing local destructable d=GetEnumDestructable() if(GetDestructableX(d)-unitCasts__regrowX)*(GetDestructableX(d)-unitCasts__regrowX)+(GetDestructableY(d)-unitCasts__regrowY)*(GetDestructableY(d)-unitCasts__regrowY)<unitCasts__regrowRange*unitCasts__regrowRange then call DestructableRestoreLife(d,GetDestructableMaxLife(d),true) endif set d=null endfunction function unitCasts__KillTree takes nothing returns nothing call KillDestructable(GetEnumDestructable()) endfunction function unitCasts__CastBloodLust takes unit u,integer id returns nothing local unit d=CreateDummy(GetOwningPlayer(u),GetUnitX(u),GetUnitY(u)) call UnitAddAbility(d,id) call IssueTargetOrderById(d,852101,u) set d=null endfunction function unitCasts__FinishVampTP takes nothing returns nothing local timer t=GetExpiredTimer() local unit u=(LoadUnitHandle(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH0))) local effect e=(LoadEffectHandle(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH1))) local real x=GetRandomReal(GetRectMinX(gg_rct_spawnVampires),GetRectMaxX(gg_rct_spawnVampires)) local real y=GetRandomReal(GetRectMinY(gg_rct_spawnVampires),GetRectMaxY(gg_rct_spawnVampires)) call DestroyEffect(e) if not IsUnitType(u,UNIT_TYPE_DEAD)then call SetUnitPosition(u,x,y) endif call FlushChildHashtable(libHandleVars__ht,GetHandleId((t))) call PauseTimer(t) call DestroyTimer(t) set t=null set u=null set e=null endfunction function OnCast takes nothing returns boolean local timer t local rect r local integer id=GetSpellAbilityId() if id=='A01S' then call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Human\\HumanLargeDeathExplode\\HumanLargeDeathExplode.mdl",GetUnitX(GetSpellAbilityUnit()),GetUnitY(GetSpellAbilityUnit()))) call RemoveUnit(GetSpellAbilityUnit()) elseif id=='tGrw' then set unitCasts__regrowX=GetSpellTargetX() set unitCasts__regrowY=GetSpellTargetY() set r=Rect(unitCasts__regrowX-unitCasts__regrowRange,unitCasts__regrowY-unitCasts__regrowRange,unitCasts__regrowX+unitCasts__regrowRange,unitCasts__regrowY+unitCasts__regrowRange) call EnumDestructablesInRect(r,null,function unitCasts__RegrowTree) call RemoveRect(r) set r=null elseif id=='tKil' then call KillDestructable(GetSpellTargetDestructable()) elseif id=='A01E' then call DisplayTimedTextToPlayer(GetTriggerPlayer(),0,0,120.,"Game code: "+gameCode) elseif id=='A01T' then call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"You can no longer login") set s__PlayerStruct_skin[(players[GetPlayerId((GetTriggerPlayer()))])]=SKIN_FAILED elseif id=='A020' then set t=CreateTimer() call SaveUnitHandle(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH0),(GetSpellAbilityUnit())) call SaveEffectHandle(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH1),(AddSpecialEffectTarget("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTo.mdl",GetSpellAbilityUnit(),"origin"))) call TimerStart(t,10.,false,function unitCasts__FinishVampTP) set t=null elseif id=='A01W' then call unitCasts__CastBloodLust(GetSpellTargetUnit(),'A01V') elseif id=='A01X' then call unitCasts__CastBloodLust(GetSpellTargetUnit(),'A014') endif return false endfunction function InitTrig_unitCasts takes nothing returns nothing local trigger trg=XCreateTrigger() call TriggerRegisterAnyUnitEvent(trg,EVENT_PLAYER_UNIT_SPELL_CAST,null) call TriggerAddCondition(trg,Condition(function OnCast)) set trg=null endfunction function unitDies__OnDeathFeed takes nothing returns nothing local unit uD=GetDyingUnit() local unit uK=GetKillingUnit() local player pD=null local player pK=null local integer iD local integer iK local integer pV=GetUnitPointValue(uD) local integer level local integer chance if uD!=null then set pD=GetOwningPlayer(uD) endif if uK!=null then set pK=GetOwningPlayer(uK) endif if pD!=null and pK!=null and pV>0 then set iD=GetPlayerId(pD) set iK=GetPlayerId(pK) if s__PlayerStruct_side[players[iD]]==SIDE_HUMAN and s__PlayerStruct_side[players[iK]]!=SIDE_HUMAN then if GetUnitTypeId(uK)=='AVFV' then set level=GetUnitAbilityLevel(uK,'A034') set chance=GetRandomInt(0,10) if(level==1 and chance<=4)or(level==2 and chance<=6)or(level==3 and chance<=8)then call AddResources(GetOwningPlayer(uK),pV,0) endif endif set s__PlayerStruct_humanFeed[players[iD]]=s__PlayerStruct_humanFeed[players[iD]]+pV set s__PlayerStruct_vampireGold[players[iK]]=s__PlayerStruct_vampireGold[players[iK]]+pV elseif s__PlayerStruct_side[players[iD]]!=SIDE_HUMAN and s__PlayerStruct_side[players[iK]]==SIDE_HUMAN then set s__PlayerStruct_vampireGoldLeaks[players[iD]]=s__PlayerStruct_vampireGoldLeaks[players[iD]]+pV endif endif set uD=null set uK=null endfunction function unitDies__FadeOutHumanEnum takes nothing returns nothing call SetUnitVertexColor(GetEnumUnit(),0,0,0,unitDies__e_alpha) endfunction function unitDies__PauseUnitsEnum takes nothing returns nothing call PauseUnit(GetEnumUnit(),true) endfunction function KillAllUnits takes nothing returns nothing call ExplodeUnit(GetEnumUnit()) endfunction function makeAlly takes player p1,player p2 returns nothing call SetPlayerAlliance(p1,p2,ALLIANCE_PASSIVE,true) call SetPlayerAlliance(p1,p2,ALLIANCE_HELP_REQUEST,true) call SetPlayerAlliance(p1,p2,ALLIANCE_HELP_RESPONSE,true) call SetPlayerAlliance(p1,p2,ALLIANCE_SHARED_XP,true) call SetPlayerAlliance(p1,p2,ALLIANCE_SHARED_SPELLS,true) call SetPlayerAlliance(p1,p2,ALLIANCE_SHARED_VISION,true) call SetPlayerAlliance(p1,p2,ALLIANCE_SHARED_CONTROL,false) call SetPlayerAlliance(p1,p2,ALLIANCE_SHARED_ADVANCED_CONTROL,false) call SetPlayerAlliance(p2,p1,ALLIANCE_PASSIVE,true) call SetPlayerAlliance(p2,p1,ALLIANCE_HELP_REQUEST,true) call SetPlayerAlliance(p2,p1,ALLIANCE_HELP_RESPONSE,true) call SetPlayerAlliance(p2,p1,ALLIANCE_SHARED_XP,true) call SetPlayerAlliance(p2,p1,ALLIANCE_SHARED_SPELLS,true) call SetPlayerAlliance(p2,p1,ALLIANCE_SHARED_VISION,true) call SetPlayerAlliance(p2,p1,ALLIANCE_SHARED_CONTROL,false) call SetPlayerAlliance(p2,p1,ALLIANCE_SHARED_ADVANCED_CONTROL,false) endfunction function makeEnemy takes player p1,player p2 returns nothing call SetPlayerAlliance(p1,p2,ALLIANCE_PASSIVE,false) call SetPlayerAlliance(p1,p2,ALLIANCE_HELP_REQUEST,false) call SetPlayerAlliance(p1,p2,ALLIANCE_HELP_RESPONSE,false) call SetPlayerAlliance(p1,p2,ALLIANCE_SHARED_XP,false) call SetPlayerAlliance(p1,p2,ALLIANCE_SHARED_SPELLS,false) call SetPlayerAlliance(p1,p2,ALLIANCE_SHARED_VISION,false) call SetPlayerAlliance(p1,p2,ALLIANCE_SHARED_CONTROL,false) call SetPlayerAlliance(p1,p2,ALLIANCE_SHARED_ADVANCED_CONTROL,false) call SetPlayerAlliance(p2,p1,ALLIANCE_PASSIVE,false) call SetPlayerAlliance(p2,p1,ALLIANCE_HELP_REQUEST,false) call SetPlayerAlliance(p2,p1,ALLIANCE_HELP_RESPONSE,false) call SetPlayerAlliance(p2,p1,ALLIANCE_SHARED_XP,false) call SetPlayerAlliance(p2,p1,ALLIANCE_SHARED_SPELLS,false) call SetPlayerAlliance(p2,p1,ALLIANCE_SHARED_VISION,false) call SetPlayerAlliance(p2,p1,ALLIANCE_SHARED_CONTROL,false) call SetPlayerAlliance(p2,p1,ALLIANCE_SHARED_ADVANCED_CONTROL,false) endfunction function unitDies__HumanDies takes integer pD,integer pK,group g,boolean nomini,integer gender returns nothing local unit u local integer i if not nomini then if numVampires<2 then call SetPlayerTechMaxAllowed(Player(pD),'U00E',1) call SetPlayerTechMaxAllowed(Player(pD),'Rufb',1) call SetPlayerTechMaxAllowed(Player(pD),'Ruwb',1) call SetPlayerTechMaxAllowed(Player(pD),'R00K',1) else call SetPlayerTechMaxAllowed(Player(pD),'U00E',0) call SetPlayerTechMaxAllowed(Player(pD),'Rufb',0) call SetPlayerTechMaxAllowed(Player(pD),'Ruwb',0) call SetPlayerTechMaxAllowed(Player(pD),'R00K',0) endif set s__PlayerStruct_side[players[pD]]=SIDE_MINION set s__PlayerStruct_state[players[pD]]=STATE_PLAYING call MiniVampTips(Player(pD)) endif call PlayerUnclaim(Player(pD)) call ForGroup(g,function KillAllUnits) call DestroyGroup(g) call SetPlayerState(Player(pD),PLAYER_STATE_GIVES_BOUNTY,1) call SetPlayerState(Player(pD),PLAYER_STATE_RESOURCE_LUMBER,0) call SetPlayerState(Player(pD),PLAYER_STATE_RESOURCE_GOLD,0) if nomini then call DisplayTimedTextToPlayer(Player(pD),0,0,10.,"|cffff0000The Vampire does not wish to ressurect you as a minion") set s__PlayerStruct_main[players[pD]]=null set s__PlayerStruct_state[players[pD]]=STATE_DEAD elseif GetPlayerSlotState(Player(pD))!=PLAYER_SLOT_STATE_PLAYING or GetPlayerController(Player(pD))!=MAP_CONTROL_USER then set s__PlayerStruct_main[players[pD]]=null set s__PlayerStruct_state[players[pD]]=STATE_DEAD else set i=GetRandomInt(0,3) if gender==GENDER_MALE then set u=CreateUnit(Player(pD),unitDies__minivamps[i],GetRectCenterX(gg_rct_spawnVampires),GetRectCenterY(gg_rct_spawnVampires),270) else set u=CreateUnit(Player(pD),unitDies__minivamps[i+4],GetRectCenterX(gg_rct_spawnVampires),GetRectCenterY(gg_rct_spawnVampires),270) endif call MoveUnitToRect(u,gg_rct_spawnVampires) call UnitAddItemById(u,'I01I') set s__PlayerStruct_main[players[pD]]=u if s__PlayerStruct_side[players[pK]]==SIDE_VAMPIRE or s__PlayerStruct_side[players[pK]]==SIDE_MINION then call SetHeroLevel(u,GetHeroLevel(s__PlayerStruct_main[players[pK]]),false) else call SetHeroLevel(u,3,false) endif set i=0 loop exitwhen i>11 if i!=pD then if s__PlayerStruct_side[players[i]]==SIDE_HUMAN then call makeEnemy(Player(i),Player(pD)) else call makeAlly(Player(i),Player(pD)) endif endif set i=i+1 endloop endif call UpdateAmounts(true) call UpdateMultiboard() set u=null endfunction function unitDies__FadeOutHuman takes nothing returns nothing local timer t=GetExpiredTimer() local integer a=(LoadInteger(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH0))) local group g=(LoadGroupHandle(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH1))) set a=a-10 if a<=0 then call unitDies__HumanDies((LoadInteger(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH2))),(LoadInteger(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH3))),g,(LoadBoolean(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH4))),(LoadInteger(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH5)))) call FlushChildHashtable(libHandleVars__ht,GetHandleId((t))) call PauseTimer(t) call DestroyTimer(t) else set unitDies__e_alpha=a call ForGroup(g,function unitDies__FadeOutHumanEnum) call SaveInteger(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH0),(a)) endif set t=null set g=null endfunction function revivingVamp takes nothing returns nothing local timer t=GetExpiredTimer() local integer id=GetHandleId(t) local unit uD=LoadUnitHandle(libHandleVars__ht,id,HASH_ATTACH0) local timerdialog td=LoadTimerDialogHandle(libHandleVars__ht,id,HASH_ATTACH1) call ReviveHeroLoc(uD,GetRectCenter(gg_rct_spawnVampires),true) call PauseTimer(t) call DestroyTimer(t) call DestroyTimerDialog(td) set t=null endfunction function leakInform takes nothing returns nothing local player p=GetEnumPlayer() local player from=GetOwningPlayer(Leak_From) local integer clr=colors[GetPlayerId(from)] call DisplayTimedTextToPlayer(p,0,0,1.5,"|cff6699ccLeak Coming|r") call PingMinimapEx(GetUnitX(Leak_From),GetUnitY(Leak_From),3,s__Color_red[clr],s__Color_green[clr],s__Color_blue[clr],false) set p=null endfunction function reviveVamp takes integer pD,unit uD returns nothing local timer t=CreateTimer() local timerdialog td=CreateTimerDialog(t) call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10,"the Ancient Vampire will revive in 30 secconds") set vampDeath[players[pD]]=vampDeath[players[pD]]+1 call TimerDialogSetTitle(td,GetPlayerNameColored(Player(pD))+" revive") call TimerDialogSetTimeColor(td,255,4,4,255) call TimerDialogDisplay(td,true) call SaveUnitHandle(libHandleVars__ht,GetHandleId(t),HASH_ATTACH0,uD) call SaveTimerDialogHandle(libHandleVars__ht,GetHandleId(t),HASH_ATTACH1,td) call TimerStart(t,30.00,false,function revivingVamp) set t=null set td=null endfunction function unitDies__OnDies takes nothing returns boolean local group g local group g2 local unit u local unit uD=GetDyingUnit() local unit uK=GetKillingUnit() local integer i local integer tD=GetUnitTypeId(uD) local integer tK=GetUnitTypeId(uK) local integer pD=GetPlayerId(GetOwningPlayer(uD)) local integer pK=GetPlayerId(GetOwningPlayer(uK)) local boolean nomini=false local integer id local item it local timer t local boolean do_revive_vamp=false local integer leakChance call unitDies__OnDeathFeed() if IsSlayer(uD)then call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10.,GetPlayerNameColored(Player(pD))+"'s "+GetUnitName(uD)+" has fallen") call StartSound(gg_snd_HPitLordWhat1) endif if IsUnitType(uD,UNIT_TYPE_STRUCTURE)then call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Human\\HCancelDeath\\HCancelDeath.mdl",GetUnitX(uD),GetUnitY(uD))) call ShowUnit(uD,false) endif if s__PlayerStruct_side[players[pD]]==SIDE_HUMAN and s__PlayerStruct_side[players[pK]]!=SIDE_HUMAN and IsUnitType(uD,UNIT_TYPE_STRUCTURE)then set s__PlayerStruct_noLeaveTimer[players[pD]]=(libBase__bigGameTime+TimerGetElapsed(libBase__bigGameTimer)) endif if s__PlayerStruct_side[players[pK]]!=SIDE_HUMAN and s__PlayerStruct_side[players[pD]]==SIDE_HUMAN and IsUnitInRange(s__PlayerStruct_main[players[pK]],uD,1000)then set u=s__PlayerStruct_main[players[pK]] if tD=='hBrc' or tD=='h001' or tD=='e003' or tD=='hHse' or tD=='hTnt' then call AddHeroXP(uK,50,false) elseif tD=='hTFb' or tD=='o000' or tD=='h002' or tD=='hTop' or tD=='o007' or tD=='h000' or tD=='o001' then call AddHeroXP(uK,'d',false) elseif tD=='hWhp' or tD=='h007' or tD=='o003' or tD=='h00B' or tD=='h008' or tD=='h003' or tD=='u00F' or tD=='n001' then call AddHeroXP(uK,200,false) elseif tD=='hTFs' or tD=='h00C' or tD=='h009' or tD=='h005' or tD=='h00G' or tD=='o006' or tD=='u00I' then call AddHeroXP(uK,500,false) elseif tD=='hTMb' or tD=='h006' or tD=='h00A' or tD=='o004' then call AddHeroXP(uK,750,false) elseif tD=='h00E' or tD=='h01R' or tD=='h00F' or tD=='h00D' or tD=='h00I' then call AddHeroXP(uK,2500,false) elseif tD=='h00H' or tD=='h00M' or tD=='h00N' or tD=='h00L' or tD=='h00S' or tD=='h01A' or tD=='h00P' or tD=='h00J' or tD=='h00U' or tD=='h00Q' or tD=='n006' or tD=='h00T' or tD=='h00K' or tD=='h00O' or tD=='u003' or tD=='hHBT' then call AddHeroXP(uK,5000,false) endif endif if uK!=null and s__PlayerStruct_side[players[pK]]!=SIDE_HUMAN and s__PlayerStruct_side[players[pD]]==SIDE_HUMAN and s__PlayerStruct_main[players[pK]]==uK then set i=1 set g=CreateGroup() call GroupEnumUnitsInRange(g,GetUnitX(uD),GetUnitY(uD),400,null) loop set u=FirstOfGroup(g) exitwhen u==null call GroupRemoveUnit(g,u) if IsSlayer(u)then set i=0 endif exitwhen i==0 endloop call DestroyGroup(g) if i!=0 then set leakChance=leakChances[pK] set it=null if leakChance<=3 then set i=GetRandomInt(0,1) if i==0 then set it=CreateItem('I01C',GetUnitX(uD),GetUnitY(uD)) else set it=CreateItem('I01D',GetUnitX(uD),GetUnitY(uD)) endif elseif leakChance<=10 then set i=GetRandomInt(0,1) if i==0 then set it=CreateItem('I01B',GetUnitX(uD),GetUnitY(uD)) else set it=CreateItem('I012',GetUnitX(uD),GetUnitY(uD)) endif endif set leakChances[pK]=GetRandomInt(1,100) if leakChances[pK]<=10 then set Leak_From=uK call ForForce(leakPlayerCheckers[pK],function leakInform) set Leak_From=null endif if it!=null then call SetItemPlayer(it,Player(pK),false) set it=null endif endif endif if uD==s__PlayerStruct_main[players[pD]]and s__PlayerStruct_side[players[pD]]==SIDE_VAMPIRE then if vampDeath[players[pD]]<vampLives then set do_revive_vamp=true else call ShareGold(pD) call ShareVampItems(pD) set s__PlayerStruct_state[players[pD]]=STATE_DEAD set g=CreateGroup() call GroupEnumUnitsOfPlayer(g,Player(pD),null) loop set u=FirstOfGroup(g) exitwhen u==null call GroupRemoveUnit(g,u) if GetUnitTypeId(u)!='n003' and u!=uD then call RemoveUnit(u) endif endloop call DestroyGroup(g) call StartSound(gg_snd_LightningBolt1) endif if s__PlayerStruct_side[players[pD]]==SIDE_VAMPIRE then call CreateItem('I000',GetUnitX(uD),GetUnitY(uD)) call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10.,GetPlayerNameColored(GetOwningPlayer(uD))+" the Ancient Vampire has been killed by "+GetPlayerNameColored(GetOwningPlayer(uK))+"|r") elseif s__PlayerStruct_side[players[pD]]==SIDE_MINION then call CreateItem('skul',GetUnitX(uD),GetUnitY(uD)) call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10.,GetPlayerNameColored(GetOwningPlayer(uD))+" the Vampire has been killed by "+GetPlayerNameColored(GetOwningPlayer(uK))+"|r") endif call TerrainDeformRipple(GetUnitX(uD),GetUnitY(uD),8,8,0,1,5.33,4,1.5,false) if do_revive_vamp==false then call UpdateAmounts(true) call UpdateMultiboard() endif endif if uD==s__PlayerStruct_main[players[pD]]and s__PlayerStruct_side[players[pD]]==SIDE_HUMAN then set i=GetGender(uD) set g2=CreateGroup() set g=CreateGroup() call GroupEnumUnitsOfPlayer(g,Player(pD),null) loop set u=FirstOfGroup(g) exitwhen u==null call GroupRemoveUnit(g,u) if IsUnitType(u,UNIT_TYPE_STRUCTURE)and(not IsUnitType(u,UNIT_TYPE_DEAD))then call PauseUnit(u,true) call GroupAddUnit(g2,u) else call ExplodeUnit(u) endif endloop call DestroyGroup(g) call SetPlayerState(Player(pD),PLAYER_STATE_RESOURCE_GOLD,0) call SetPlayerState(Player(pD),PLAYER_STATE_RESOURCE_LUMBER,0) set s__PlayerStruct_state[players[pD]]=STATE_DEAD if s__PlayerStruct_side[players[pK]]==SIDE_VAMPIRE and s__PlayerStruct_allowMini[players[pK]]==false then set nomini=true endif set t=CreateTimer() call SaveInteger(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH0),(255)) call SaveGroupHandle(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH1),(g2)) call SaveInteger(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH2),(pD)) call SaveInteger(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH3),(pK)) call SaveBoolean(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH4),(nomini)) call SaveInteger(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH5),(i)) call TimerStart(t,.2,true,function unitDies__FadeOutHuman) set t=null set g2=null call SetPlayerState(Player(pD),PLAYER_STATE_GIVES_BOUNTY,0) call StartSound(gg_snd_bfbp) if nomini then call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10.,GetPlayerNameColored(Player(pD))+" has fallen") else call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10.,GetPlayerNameColored(Player(pD))+" has fallen and will now be reborn as a vampire") endif endif if do_revive_vamp then call reviveVamp(pD,uD) endif set uD=null set g=null set g2=null set u=null set uK=null set it=null return false endfunction function InitTrig_unitDies takes nothing returns nothing local trigger trg=XCreateTrigger() local integer i=0 call TriggerRegisterAnyUnitEvent(trg,EVENT_PLAYER_UNIT_DEATH,null) call TriggerAddCondition(trg,Condition(function unitDies__OnDies)) set trg=null set unitDies__minivamps[0]='U00C' set unitDies__minivamps[1]='U00B' set unitDies__minivamps[2]='U00K' set unitDies__minivamps[3]='U00D' set unitDies__minivamps[4]='U009' set unitDies__minivamps[5]='U007' set unitDies__minivamps[6]='U008' set unitDies__minivamps[7]='U00A' endfunction function unitEnters__OnEnter takes nothing returns boolean local unit u=GetTriggerUnit() local integer p=GetPlayerId(GetOwningPlayer(u)) local integer i local integer unitId=GetUnitTypeId(u) local group g local unit ug if GetUnitTypeId(u)=='oCwg' then call StartSound(gg_snd_ReceiveGold) call RemoveUnit(u) call AddResources(Player(p),1,0) endif if IsSlayer(u)then call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10.,GetPlayerNameColored(Player(p))+"|r has created a "+GetUnitName(u)+" at "+TimeString((libBase__bigGameTime+TimerGetElapsed(libBase__bigGameTimer)))) if slayerNum<2 then if slayerNum==0 then call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10.,GetPlayerNameColored(Player(p))+"|r was first who created a Slayer. Plus 1 lvl to him.") elseif slayerNum==1 then call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10.,GetPlayerNameColored(Player(p))+"|r was second. Plus 1 lvl to him!") endif call SetHeroLevel(u,GetHeroLevel(u)+1,false) endif set slayerNum=slayerNum+1 endif if ShowUnitMessage('h00A')then call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,5,"A Human has trained a level 3 harvester!") endif if unitId=='h00A' and uniqueUnit(p,unitId)==true then call toHumans(5,GetPlayerNameColored(Player(p))+"|r has trained first "+GetUnitName(u)+" at "+TimeString(GameTime())) call emitUnit(p,unitId) endif if IsVampire(u)and s__PlayerStruct_side[players[p]]==SIDE_VAMPIRE and s__PlayerStruct_main[players[p]]==null then set s__PlayerStruct_main[players[p]]=u call MoveUnitToRect(u,gg_rct_spawnVampires) call SetHeroLevel(u,3,false) call DecorateVamp(u) call UnitAddItemById(u,'I01I') call ShowUnit(u,false) set i=0 loop exitwhen i>=numVampTypes call SetPlayerTechMaxAllowed(Player(p),vampTypes[i],0) set i=i+1 endloop endif if GetUnitTypeId(u)=='e004' or GetUnitTypeId(u)=='e005' then set g=CreateGroup() call GroupEnumUnitsInRangeOfLoc(g,GetUnitLoc(u),800,null) loop set ug=FirstOfGroup(g) exitwhen ug==null call GroupRemoveUnit(g,ug) if IsWall(ug)and IsUnitEnemy(ug,Player(p))then call IssueTargetOrder(u,"attack",ug) set ug=null endif endloop call DestroyGroup(g) endif set u=null set g=null set ug=null return false endfunction function wagonEnters takes nothing returns boolean local unit u=GetTriggerUnit() if GetUnitTypeId(u)=='u002' then call UnitAddAbility(u,'A02I') endif return false endfunction function wagonLeaves takes nothing returns boolean local unit u=GetTriggerUnit() if GetUnitTypeId(u)=='u002' then call UnitRemoveAbility(u,'A02I') endif return false endfunction function InitTrig_unitEnters takes nothing returns nothing local trigger trg1=XCreateTrigger() local trigger trg2=XCreateTrigger() local trigger trg3=XCreateTrigger() local region rgn=CreateRegion() call RegionAddRect(rgn,bj_mapInitialPlayableArea) call TriggerRegisterEnterRegion(trg1,rgn,null) call TriggerAddCondition(trg1,Condition(function unitEnters__OnEnter)) call TriggerRegisterEnterRegion(trg2,center,null) call TriggerAddCondition(trg2,Condition(function wagonEnters)) call TriggerRegisterLeaveRegion(trg3,center,null) call TriggerAddCondition(trg3,Condition(function wagonLeaves)) set rgn=null set trg1=null set trg2=null set trg3=null endfunction function unitRevives__OnRevive takes nothing returns boolean local unit u=GetRevivingUnit() local integer p=GetPlayerId(GetOwningPlayer(u)) if IsSlayer(u)then call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,10.,GetPlayerNameColored(Player(p))+"'s "+GetUnitName(u)+" has been revived") endif set u=null return false endfunction function InitTrig_unitRevives takes nothing returns nothing local trigger trg=XCreateTrigger() call TriggerRegisterAnyUnitEvent(trg,EVENT_PLAYER_HERO_REVIVE_FINISH,null) call TriggerAddCondition(trg,Condition(function unitRevives__OnRevive)) set trg=null endfunction function unitTeleport__PoolKick takes nothing returns nothing local timer t=GetExpiredTimer() local unit u=(LoadUnitHandle(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH0))) if(not IsUnitType(u,UNIT_TYPE_DEAD))and IsUnitInRegion(unitTeleport__rgnPool,u)then call MoveUnitToRect(u,gg_rct_poolDiscard) endif call FlushChildHashtable(libHandleVars__ht,GetHandleId((t))) call PauseTimer(t) call DestroyTimer(t) set t=null set u=null endfunction function unitTeleport__EnterPool takes nothing returns boolean local unit u=GetTriggerUnit() local timer t if s__PlayerStruct_side[(players[GetPlayerId((GetOwningPlayer(u)))])]!=SIDE_HUMAN and u==s__PlayerStruct_main[(players[GetPlayerId((GetOwningPlayer(u)))])]then call DisplayTimedTextToPlayer(GetOwningPlayer(u),0,0,5,"You will be automaticly teleported out of the dancepool in 5 seconds") set t=CreateTimer() call SaveUnitHandle(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH0),(u)) call TimerStart(t,5.,false,function unitTeleport__PoolKick) set t=null endif set u=null return false endfunction function unitTeleport__TeleportToPool takes nothing returns boolean local unit u=GetTriggerUnit() return false if s__PlayerStruct_side[(players[GetPlayerId((GetOwningPlayer(u)))])]==SIDE_HUMAN then call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl",GetUnitX(u),GetUnitY(u))) call MoveUnitToRect(u,gg_rct_poolMain) call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl",GetUnitX(u),GetUnitY(u))) endif set u=null return false endfunction function InitTrig_unitTeleport takes nothing returns nothing local trigger trg=CreateTrigger() local region rgn=CreateRegion() call RegionAddRect(rgn,gg_rct_TeleportRecieveVampire1) call RegionAddRect(rgn,gg_rct_TeleportRecieveVampire2) call RegionAddRect(rgn,gg_rct_TeleportRecieveVampire3) call RegionAddRect(rgn,gg_rct_TeleportRecieveVampire4) call TriggerRegisterEnterRegion(trg,rgn,null) call TriggerAddCondition(trg,Condition(function unitTeleport__TeleportToPool)) set trg=XCreateTrigger() set unitTeleport__rgnPool=CreateRegion() call RegionAddRect(unitTeleport__rgnPool,gg_rct_poolEntire) call TriggerRegisterEnterRegion(trg,unitTeleport__rgnPool,null) call TriggerAddCondition(trg,Condition(function unitTeleport__EnterPool)) set trg=null set rgn=null endfunction function vampireResearch__OnResearchStart takes nothing returns boolean local unit u=s__PlayerStruct_main[(players[GetPlayerId((GetTriggerPlayer()))])] local integer id=GetResearched() local integer replaceWith=0 local unit center=GetResearchingUnit() local integer i=0 local integer k=UnitInventorySize(center) local item array items if id=='R00O' then if GetUnitTypeId(center)=='u00J' then set replaceWith='u00H' else set replaceWith='u00J' endif loop exitwhen i>k set items[i]=UnitItemInSlot(center,i) set i=i+1 endloop set center=ReplaceUnitBJ(center,replaceWith,bj_UNIT_STATE_METHOD_DEFAULTS) set i=0 loop exitwhen i>k call UnitAddItem(center,items[i]) set i=i+1 endloop if GetLocalPlayer()==GetTriggerPlayer()then call ClearSelection() call SelectUnit(center,true) endif endif return false endfunction function vampireResearch__OnResearch takes nothing returns boolean local unit u=s__PlayerStruct_main[(players[GetPlayerId((GetTriggerPlayer()))])] local integer id=GetResearched() local integer idN if id=='R00E' then call SetHeroStr(u,GetHeroStr(u,false)+300,true) elseif id=='R00C' then call SetHeroAgi(u,GetHeroAgi(u,false)+300,true) elseif id=='R00D' then call SetHeroInt(u,GetHeroInt(u,false)+300,true) elseif id=='R00G' then call SetHeroStr(u,GetHeroStr(u,false)+300,true) call SetHeroAgi(u,GetHeroAgi(u,false)+300,true) call SetHeroInt(u,GetHeroInt(u,false)+300,true) elseif id=='R00H' then call SetHeroStr(u,GetHeroStr(u,false)+2000,true) call SetHeroAgi(u,GetHeroAgi(u,false)+2000,true) call SetHeroInt(u,GetHeroInt(u,false)+2000,true) elseif id=='R00L' then if GetUnitAbilityLevel(u,'A023')==0 then call UnitAddAbilityBJ('A023',u) else call IncUnitAbilityLevelSwapped('A023',u) endif elseif id=='R00S' then if GetUnitTypeId(u)=='E002' then call IncUnitAbilityLevel(u,'A031') elseif GetUnitTypeId(u)=='E000' then call IncUnitAbilityLevel(u,'A033') elseif GetUnitTypeId(u)=='E001' then call IncUnitAbilityLevel(u,'A032') elseif GetUnitTypeId(u)=='AFVF' then call IncUnitAbilityLevel(u,'A034') endif elseif id=='R00I' then if GetHeroLevel(u)==200 then call AddResources(GetTriggerPlayer(),25,0) call DisplayTimedTextToPlayer(GetTriggerPlayer(),0,0,5.,"You are at max level, your gold has been refunded!") else call SetHeroLevel(u,GetHeroLevel(u)+1,false) endif endif set u=null return false endfunction function InitTrig_vampireResearch takes nothing returns nothing local trigger trg1=CreateTrigger() local trigger trg2=CreateTrigger() call TriggerRegisterAnyUnitEvent(trg1,EVENT_PLAYER_UNIT_RESEARCH_FINISH,null) call TriggerAddCondition(trg1,Condition(function vampireResearch__OnResearch)) set trg1=null call TriggerRegisterAnyUnitEvent(trg2,EVENT_PLAYER_UNIT_RESEARCH_START,null) call TriggerAddCondition(trg2,Condition(function vampireResearch__OnResearchStart)) set trg2=null endfunction function humanResearch__OnResearch takes nothing returns boolean local integer id=GetResearched() local player p=GetTriggerPlayer() local integer i=0 if id=='Roar' then call SetPlayerTechResearched(p,'R00N',1) elseif id=='R00B' then set i=GetPlayerTechMaxAllowed(p,'hHBT') call SetPlayerTechMaxAllowed(p,'hHBT',i+1) endif return false endfunction function LevelReduce_Slayer takes nothing returns nothing local unit u=GetEnumUnit() local integer l=0 if IsSlayer(u)then set l=GetHeroLevel(u) if l>1 then call UnitStripHeroLevel(u,1) set slayerReduceLvl_Result=true endif endif set u=null endfunction function humanResearch__beforeResearch takes nothing returns boolean local integer id=GetResearched() local player p=GetTriggerPlayer() local group g local unit u=GetResearchingUnit() if id=='R00R' then set slayerReduceLvl_Result=false set g=CreateGroup() call GroupEnumUnitsOfPlayer(g,p,null) call ForGroup(g,function LevelReduce_Slayer) call IssueImmediateOrderById(u,0xD0008) if slayerReduceLvl_Result then call SetPlayerState(p,PLAYER_STATE_RESOURCE_LUMBER,GetPlayerState(p,PLAYER_STATE_RESOURCE_LUMBER)+2000) else call DisplayTimedTextToPlayer(p,0,0,5,"|cffff0000Your slayer`s level is not enough!") endif endif set g=null return false endfunction function InitTrig_humanResearch takes nothing returns nothing local trigger trg1=CreateTrigger() local trigger trg2=CreateTrigger() call TriggerRegisterAnyUnitEvent(trg1,EVENT_PLAYER_UNIT_RESEARCH_FINISH,null) call TriggerAddCondition(trg1,Condition(function humanResearch__OnResearch)) call TriggerRegisterAnyUnitEvent(trg2,EVENT_PLAYER_UNIT_RESEARCH_START,null) call TriggerAddCondition(trg2,Condition(function humanResearch__beforeResearch)) set trg1=null set trg2=null endfunction function forceItemCd takes unit u,integer id,item remove returns nothing local item citem if remove!=null then call UnitRemoveItem(u,remove) endif set citem=UnitAddItemById(u,id) call UnitUseItem(u,citem) call RemoveItem(citem) if remove!=null then call UnitAddItem(u,remove) endif endfunction function forceAbilityCd takes unit u,integer id,integer dummy,string order returns nothing call UnitRemoveAbility(u,id) call UnitAddAbility(u,dummy) call UnitAddAbility(u,id) call IssueImmediateOrder(u,order) endfunction function getRicoLikeItem takes unit u returns item local integer i=0 local integer k=UnitInventorySize(u) local integer id local item uitem loop exitwhen i>k set uitem=UnitItemInSlot(u,i) set id=GetItemTypeId(uitem) if id=='I003' or id=='I00K' then return uitem endif set i=i+1 endloop return null endfunction function decreseHpByPercent takes nothing returns nothing local timer t=GetExpiredTimer() local integer id=GetHandleId(t) local unit uD=LoadUnitHandle(libHandleVars__ht,id,HASH_ATTACH0) local integer i=LoadInteger(libHandleVars__ht,id,HASH_ATTACH1) call SetUnitState(uD,UNIT_STATE_LIFE,GetUnitState(uD,UNIT_STATE_LIFE)*0.97) if i<40 then set t=CreateTimer() call SaveInteger(libHandleVars__ht,id,HASH_ATTACH1,i+1) else call PauseTimer(t) call DestroyTimer(t) endif endfunction function vampireItem__OnUse takes nothing returns boolean local item i=GetManipulatedItem() local integer id=GetItemTypeId(i) local timer t local unit uD=GetManipulatingUnit() if id=='I01E' then set t=CreateTimer() call SaveInteger(libHandleVars__ht,GetHandleId(t),HASH_ATTACH1,0) call SaveUnitHandle(libHandleVars__ht,GetHandleId(t),HASH_ATTACH0,uD) call TimerStart(t,.50,true,function decreseHpByPercent) set t=null return false endif return false endfunction function vampireSpells__OnSpell takes nothing returns boolean local integer id=GetSpellAbilityId() local unit target=GetSpellTargetUnit() local player p=GetTriggerPlayer() local unit u=GetSpellAbilityUnit() local integer i=0 local item citem if GetUnitTypeId(u)=='E002' then endif if id=='A02J' then call reduceArmorByPercent(target,0.2,'A02H',10.0) endif return false endfunction function vampireSpells__Attacked takes nothing returns boolean local unit u=GetTriggerUnit() local unit d=GetAttacker() local real hp=0.0 if UnitHasItemOfTypeBJ(u,'I00Z')or UnitHasItemOfTypeBJ(u,'I01X')then return false endif if GetUnitAbilityLevel(d,'Afbt')>0 and IsUnitType(u,UNIT_TYPE_HERO)then call SetUnitState(u,UNIT_STATE_MANA,GetUnitState(u,UNIT_STATE_MANA)-50) endif return false endfunction function InitTrig_vampireSpells takes nothing returns nothing local trigger trg1=CreateTrigger() local trigger trg2=CreateTrigger() local trigger trg3=CreateTrigger() call TriggerRegisterAnyUnitEvent(trg1,EVENT_PLAYER_UNIT_USE_ITEM,null) call TriggerAddCondition(trg1,Condition(function vampireItem__OnUse)) set trg1=null call TriggerRegisterAnyUnitEvent(trg2,EVENT_PLAYER_UNIT_SPELL_CAST,null) call TriggerAddCondition(trg2,Condition(function vampireSpells__OnSpell)) set trg2=null call TriggerRegisterAnyUnitEvent(trg3,EVENT_PLAYER_UNIT_ATTACKED,null) call TriggerAddCondition(trg3,Condition(function vampireSpells__Attacked)) set trg3=null endfunction function humanSpells__OnOrder takes nothing returns boolean local string order=OrderId2String(GetIssuedOrderId()) local unit u=GetOrderedUnit() if order=="repairon" then elseif order=="repairoff" then elseif order=="channel" then call IssuePointOrderLoc(u,"blink",GetOrderPointLoc()) endif return false endfunction function humanSpells__ChangeBlink1 takes nothing returns nothing local timer t=GetExpiredTimer() local integer id=GetHandleId(t) local unit u=LoadUnitHandle(libHandleVars__ht,id,HASH_ATTACH0) call UnitRemoveAbility(u,'AIbk') call UnitAddAbility(u,'A00X') call PauseTimer(t) call DestroyTimer(t) set t=null endfunction function humanSpells__ChangeBlink2 takes nothing returns nothing local timer t=GetExpiredTimer() local integer id=GetHandleId(t) local unit u=LoadUnitHandle(libHandleVars__ht,id,HASH_ATTACH0) call UnitRemoveAbility(u,'A00X') call UnitAddAbility(u,'AIbk') call PauseTimer(t) call DestroyTimer(t) set t=null endfunction function humanSpells__disableLeackChecker takes nothing returns nothing local timer t=GetExpiredTimer() local integer id=GetHandleId(t) local player p=LoadPlayerHandle(libHandleVars__ht,id,HASH_ATTACH0) local integer from=LoadInteger(libHandleVars__ht,id,HASH_ATTACH1) local integer i=0 call ForceRemovePlayer(leakPlayerCheckers[from],p) call DisplayTimedTextToPlayer(p,0,0,1.5,"|cff6699ccLeak Detector deactivated") call PauseTimer(t) call DestroyTimer(t) set t=null endfunction function humanSpells__restoreUltyEnum takes nothing returns boolean local unit u=GetEnumUnit() local integer ud=GetUnitUserData(u) local integer bd=removeUlty__UnitData[ud] if bd!=0 then set removeUlty__Now[bd]=0 endif call GroupRemoveUnit(removeUlty_Group,u) return false endfunction function humanSpells__OnSpellFinish takes nothing returns boolean local integer id=GetSpellAbilityId() local unit u=GetSpellAbilityUnit() local integer i=GetUnitUserData(u) local timer t=null if id=='A019' then set t=CreateTimer() set removeUlty_Group=CreateGroup() call GroupEnumUnitsInRangeOfLoc(removeUlty_Group,GetUnitLoc(u),1200,null) call GroupRemoveUnit(removeUlty_Group,u) call ForGroup(removeUlty_Group,function humanSpells__restoreUltyEnum) call DestroyGroup(removeUlty_Group) set removeUlty_Group=null set t=null elseif id=='Ahrp' then if GetUnitTypeId(u)=='hEng' then call UnitRemoveAbility(u,'BUhf') endif endif return false endfunction function humanSpells__OnSpellChannel takes nothing returns boolean local integer id=GetSpellAbilityId() local player p=GetTriggerPlayer() local unit target=GetSpellTargetUnit() if id=='A035' then call DummySpellTarget(p,target,'A036',"thunderbolt") endif return false endfunction function humanSpells__OnConstructFinish takes nothing returns boolean local unit u=GetTriggerUnit() local integer id=GetUnitTypeId(u) if id=='h020' then call IssueImmediateOrder(u,"slowon") endif return false endfunction function humanSpells__OnTrainFinish takes nothing returns boolean local unit u=GetTrainedUnit() local integer id=GetUnitTypeId(u) if id=='h007' and(GameMode==GameMode_Fast or GameMode==GameMode_SuperFast)then call UnitRemoveAbility(u,'A000') call UnitAddAbility(u,'A038') elseif id=='h00A' and(GameMode==GameMode_Fast or GameMode==GameMode_SuperFast)then call UnitRemoveAbility(u,'A00D') call UnitAddAbility(u,'A039') endif return false endfunction function humanSpells__OnSpellBegin takes nothing returns boolean local integer id=GetSpellAbilityId() local unit u=GetSpellAbilityUnit() local unit target local integer v local player p=GetOwningPlayer(u) local timer t=null if id=='A03I' then set target=GetSpellTargetUnit() set v=GetPlayerId(GetOwningPlayer(target)) call ForceAddPlayer(leakPlayerCheckers[v],p) set t=CreateTimer() call SavePlayerHandle(libHandleVars__ht,GetHandleId(t),HASH_ATTACH0,p) call SaveInteger(libHandleVars__ht,GetHandleId(t),HASH_ATTACH1,v) call TimerStart(t,20.0,false,function humanSpells__disableLeackChecker) set t=null elseif id=='Ahrp' then set target=GetSpellTargetUnit() if GetUnitTypeId(u)=='hEng' and p !=GetOwningPlayer(target)then call DummySpellTarget(p,u,'A03J',"unholyfrenzy") endif endif return false endfunction function removeUlty__allocate takes nothing returns integer local integer this=removeUlty_F if this!=0 then set removeUlty_F=removeUlty_V[this] else set removeUlty_I=removeUlty_I+1 set this=removeUlty_I endif if(this>8190)then return 0 endif set removeUlty_V[this]=-1 return this endfunction function removeUlty_deallocate takes integer this returns nothing if this==null then return elseif removeUlty_V[this]!=-1 then return endif set removeUlty_V[this]=removeUlty_F set removeUlty_F=this endfunction function removeUlty__OnExpire takes nothing returns nothing local timer t=GetExpiredTimer() local integer d=(LoadInteger(libHandleVars__ht,GetHandleId((t)),(HASH_ATTACH0))) call UnitRemoveType(removeUlty__u[d],UNIT_TYPE_ANCIENT) set removeUlty__UnitData[(GetUnitUserData((removeUlty__u[d])))]=0 set removeUlty__t[d]=null set removeUlty__u[d]=null set removeUlty__Now[d]=0 call removeUlty_deallocate(d) call FlushChildHashtable(libHandleVars__ht,GetHandleId((t))) call PauseTimer(t) call DestroyTimer(t) set t=null endfunction function humanSpells__removeUltyEnum takes nothing returns boolean local unit u=GetEnumUnit() local integer ud=GetUnitUserData(u) local integer bd=removeUlty__UnitData[ud] if not IsUnitType(u,UNIT_TYPE_STRUCTURE)then call GroupRemoveUnit(removeUlty_Group,u) return false endif if bd==0 then set bd=removeUlty__allocate() set removeUlty__t[bd]=CreateTimer() call SaveInteger(libHandleVars__ht,GetHandleId(removeUlty__t[bd]),HASH_ATTACH0,bd) set removeUlty__u[bd]=u set removeUlty__UnitData[ud]=bd call TimerStart(removeUlty__t[bd],90.,false,function removeUlty__OnExpire) set removeUlty__Now[bd]=1 else if removeUlty__Now[bd]==0 then call UnitAddType(u,UNIT_TYPE_ANCIENT) endif endif call GroupRemoveUnit(removeUlty_Group,u) return false endfunction function humanSpells__OnEffect takes nothing returns boolean local integer id=GetSpellAbilityId() local unit u=GetTriggerUnit() local player p=GetOwningPlayer(u) local timer t=null if id=='A019' then set t=CreateTimer() set removeUlty_Group=CreateGroup() call GroupEnumUnitsInRangeOfLoc(removeUlty_Group,GetUnitLoc(u),1200,null) call GroupRemoveUnit(removeUlty_Group,u) call ForGroup(removeUlty_Group,function humanSpells__removeUltyEnum) call DestroyGroup(removeUlty_Group) set removeUlty_Group=null set t=null endif return false endfunction function InitTrig_humanSpells takes nothing returns nothing local trigger trg1=CreateTrigger() local trigger trg2=CreateTrigger() local trigger trg3=CreateTrigger() local trigger trg4=CreateTrigger() local trigger trg5=CreateTrigger() local trigger trg6=CreateTrigger() local trigger trg7=CreateTrigger() call TriggerRegisterAnyUnitEvent(trg1,EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER,null) call TriggerRegisterAnyUnitEvent(trg1,EVENT_PLAYER_UNIT_ISSUED_ORDER,null) call TriggerAddCondition(trg1,Condition(function humanSpells__OnOrder)) set trg1=null call TriggerRegisterAnyUnitEvent(trg2,EVENT_PLAYER_UNIT_SPELL_CAST,null) call TriggerAddCondition(trg2,Condition(function humanSpells__OnSpellBegin)) set trg2=null call TriggerRegisterAnyUnitEvent(trg3,EVENT_PLAYER_UNIT_SPELL_ENDCAST,null) call TriggerAddCondition(trg3,Condition(function humanSpells__OnSpellFinish)) set trg3=null call TriggerRegisterAnyUnitEvent(trg4,EVENT_PLAYER_UNIT_SPELL_CHANNEL,null) call TriggerAddCondition(trg4,Condition(function humanSpells__OnSpellChannel)) set trg4=null call TriggerRegisterAnyUnitEvent(trg5,EVENT_PLAYER_UNIT_CONSTRUCT_FINISH,null) call TriggerRegisterAnyUnitEvent(trg5,EVENT_PLAYER_UNIT_UPGRADE_FINISH,null) call TriggerAddCondition(trg5,Condition(function humanSpells__OnConstructFinish)) set trg5=null call TriggerRegisterAnyUnitEvent(trg6,EVENT_PLAYER_UNIT_TRAIN_FINISH,null) call TriggerAddCondition(trg6,Condition(function humanSpells__OnTrainFinish)) set trg6=null call TriggerRegisterAnyUnitEvent(trg7,EVENT_PLAYER_UNIT_SPELL_EFFECT,null) call TriggerAddCondition(trg7,Condition(function humanSpells__OnEffect)) set trg7=null endfunction function victoryHuman__OnVictory takes nothing returns boolean set gameOver=true call DisableTriggers() call StopMusic(true) call StartSound(gg_snd_GromPissed3) call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,3600,"|cffFF0000The world is saved...|r") call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,3600,"|cffFF0000Get the latest version from http://clanzoom.co.cc|r") call StartSound(gg_snd_rock) return false endfunction function InitTrig_victoryHuman takes nothing returns nothing set gg_trg_victoryHuman=CreateTrigger() call TriggerAddCondition(gg_trg_victoryHuman,Condition(function victoryHuman__OnVictory)) endfunction function victoryVampire__OnVictory takes nothing returns boolean set gameOver=true call DisableTriggers() call StopMusic(true) call StartSound(gg_snd_EndSoundForVamps) call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,3600,"|cffFF0000The world is doomed...|r") call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,3600,"|cffFF0000Get the latest version from http://clanzoom.co.cc|r") call StartSound(gg_snd_rock) return false endfunction function InitTrig_victoryVampire takes nothing returns nothing set gg_trg_victoryVampire=CreateTrigger() call TriggerAddCondition(gg_trg_victoryVampire,Condition(function victoryVampire__OnVictory)) endfunction function tintBuildings__RegisterTint takes integer id,integer red,integer green,integer blue,integer alpha returns nothing call SaveBoolean(tintBuildings__tht,id,tintBuildings__TINT_ENABLED,true) call SaveInteger(tintBuildings__tht,id,tintBuildings__TINT_RED,red) call SaveInteger(tintBuildings__tht,id,tintBuildings__TINT_GREEN,green) call SaveInteger(tintBuildings__tht,id,tintBuildings__TINT_BLUE,blue) call SaveInteger(tintBuildings__tht,id,tintBuildings__TINT_ALPHA,alpha) endfunction function tintBuildings__OnBuild takes nothing returns boolean local unit u=GetTriggerUnit() local integer id=GetUnitTypeId(u) if LoadBoolean(tintBuildings__tht,id,tintBuildings__TINT_ENABLED)then call SetUnitVertexColor(u,LoadInteger(tintBuildings__tht,id,tintBuildings__TINT_RED),LoadInteger(tintBuildings__tht,id,tintBuildings__TINT_GREEN),LoadInteger(tintBuildings__tht,id,tintBuildings__TINT_BLUE),LoadInteger(tintBuildings__tht,id,tintBuildings__TINT_ALPHA)) endif set u=null return false endfunction function InitTrig_tintBuildings takes nothing returns nothing local trigger trg=XCreateTrigger() call TriggerRegisterAnyUnitEvent(trg,EVENT_PLAYER_UNIT_CONSTRUCT_START,null) call TriggerRegisterAnyUnitEvent(trg,EVENT_PLAYER_UNIT_UPGRADE_START,null) call TriggerRegisterAnyUnitEvent(trg,EVENT_PLAYER_UNIT_UPGRADE_CANCEL,null) call TriggerAddCondition(trg,Condition(function tintBuildings__OnBuild)) set trg=null call tintBuildings__RegisterTint('h001',255,255,70,180) call tintBuildings__RegisterTint('h000',255,255,0,180) call tintBuildings__RegisterTint('h003',150,0,150,230) call tintBuildings__RegisterTint('h005','d','d',255,255) call tintBuildings__RegisterTint('h006',50,255,50,180) call tintBuildings__RegisterTint('h00Z',50,255,'}',255) call tintBuildings__RegisterTint('h01R',150,30,20,255) call tintBuildings__RegisterTint('h00E','d',30,30,205) call tintBuildings__RegisterTint('h00F',255,255,255,255) call tintBuildings__RegisterTint('h00P',20,20,20,255) call tintBuildings__RegisterTint('u000',25,255,65,128) call tintBuildings__RegisterTint('u003',0,0,0,128) call tintBuildings__RegisterTint('u00I',255,255,255,'d') call tintBuildings__RegisterTint('u00U',25,25,25,'d') call tintBuildings__RegisterTint('h00D',255,75,75,128) call tintBuildings__RegisterTint('h00S',180,0,0,128) call tintBuildings__RegisterTint('h00L',0,0,0,128) call tintBuildings__RegisterTint('h01U',255,50,50,255) call tintBuildings__RegisterTint('h020',150,75,0,255) call tintBuildings__RegisterTint('hHBT',255,50,50,128) call tintBuildings__RegisterTint('h00H',255,255,255,255) call tintBuildings__RegisterTint('h00M',255,255,255,128) endfunction function InitCustomFirstTriggers takes nothing returns nothing call InitTrig_initPlayers() call InitTrig_libCinematic() endfunction function InitCustomTriggers takes nothing returns nothing call InitTrig_vampSpawns() call InitTrig_Wyrm() call InitTrig_resumeUnits() call InitTrig_timedStuff() call InitTrig_incomeGoldmine() endfunction function RunInitializationTriggers takes nothing returns nothing call ConditionalTriggerExecute(gg_trg_initBases) call ConditionalTriggerExecute(gg_trg_initQuests) call ConditionalTriggerExecute(gg_trg_initUnits) call ConditionalTriggerExecute(gg_trg_initMisc) call ConditionalTriggerExecute(gg_trg_skins) call ConditionalTriggerExecute(gg_trg_vampSpawns) call ConditionalTriggerExecute(gg_trg_incomeGoldmine) endfunction function InitCustomPlayerSlots takes nothing returns nothing call SetPlayerStartLocation(Player(0),0) call ForcePlayerStartLocation(Player(0),0) call SetPlayerColor(Player(0),ConvertPlayerColor(0)) call SetPlayerRacePreference(Player(0),RACE_PREF_HUMAN) call SetPlayerRaceSelectable(Player(0),false) call SetPlayerController(Player(0),MAP_CONTROL_USER) call SetPlayerStartLocation(Player(1),1) call ForcePlayerStartLocation(Player(1),1) call SetPlayerColor(Player(1),ConvertPlayerColor(1)) call SetPlayerRacePreference(Player(1),RACE_PREF_HUMAN) call SetPlayerRaceSelectable(Player(1),false) call SetPlayerController(Player(1),MAP_CONTROL_USER) call SetPlayerStartLocation(Player(2),2) call ForcePlayerStartLocation(Player(2),2) call SetPlayerColor(Player(2),ConvertPlayerColor(2)) call SetPlayerRacePreference(Player(2),RACE_PREF_HUMAN) call SetPlayerRaceSelectable(Player(2),false) call SetPlayerController(Player(2),MAP_CONTROL_USER) call SetPlayerStartLocation(Player(3),3) call ForcePlayerStartLocation(Player(3),3) call SetPlayerColor(Player(3),ConvertPlayerColor(3)) call SetPlayerRacePreference(Player(3),RACE_PREF_HUMAN) call SetPlayerRaceSelectable(Player(3),false) call SetPlayerController(Player(3),MAP_CONTROL_USER) call SetPlayerStartLocation(Player(4),4) call ForcePlayerStartLocation(Player(4),4) call SetPlayerColor(Player(4),ConvertPlayerColor(4)) call SetPlayerRacePreference(Player(4),RACE_PREF_HUMAN) call SetPlayerRaceSelectable(Player(4),false) call SetPlayerController(Player(4),MAP_CONTROL_USER) call SetPlayerStartLocation(Player(5),5) call ForcePlayerStartLocation(Player(5),5) call SetPlayerColor(Player(5),ConvertPlayerColor(5)) call SetPlayerRacePreference(Player(5),RACE_PREF_HUMAN) call SetPlayerRaceSelectable(Player(5),false) call SetPlayerController(Player(5),MAP_CONTROL_USER) call SetPlayerStartLocation(Player(6),6) call ForcePlayerStartLocation(Player(6),6) call SetPlayerColor(Player(6),ConvertPlayerColor(6)) call SetPlayerRacePreference(Player(6),RACE_PREF_HUMAN) call SetPlayerRaceSelectable(Player(6),false) call SetPlayerController(Player(6),MAP_CONTROL_USER) call SetPlayerStartLocation(Player(7),7) call ForcePlayerStartLocation(Player(7),7) call SetPlayerColor(Player(7),ConvertPlayerColor(7)) call SetPlayerRacePreference(Player(7),RACE_PREF_HUMAN) call SetPlayerRaceSelectable(Player(7),false) call SetPlayerController(Player(7),MAP_CONTROL_USER) call SetPlayerStartLocation(Player(8),8) call ForcePlayerStartLocation(Player(8),8) call SetPlayerColor(Player(8),ConvertPlayerColor(8)) call SetPlayerRacePreference(Player(8),RACE_PREF_HUMAN) call SetPlayerRaceSelectable(Player(8),false) call SetPlayerController(Player(8),MAP_CONTROL_USER) call SetPlayerStartLocation(Player(9),9) call ForcePlayerStartLocation(Player(9),9) call SetPlayerColor(Player(9),ConvertPlayerColor(9)) call SetPlayerRacePreference(Player(9),RACE_PREF_HUMAN) call SetPlayerRaceSelectable(Player(9),false) call SetPlayerController(Player(9),MAP_CONTROL_USER) call SetPlayerStartLocation(Player(10),10) call ForcePlayerStartLocation(Player(10),10) call SetPlayerColor(Player(10),ConvertPlayerColor(10)) call SetPlayerRacePreference(Player(10),RACE_PREF_UNDEAD) call SetPlayerRaceSelectable(Player(10),false) call SetPlayerController(Player(10),MAP_CONTROL_USER) call SetPlayerStartLocation(Player(11),11) call ForcePlayerStartLocation(Player(11),11) call SetPlayerColor(Player(11),ConvertPlayerColor(11)) call SetPlayerRacePreference(Player(11),RACE_PREF_UNDEAD) call SetPlayerRaceSelectable(Player(11),false) call SetPlayerController(Player(11),MAP_CONTROL_USER) endfunction function InitCustomTeams takes nothing returns nothing call SetPlayerTeam(Player(0),0) call SetPlayerTeam(Player(1),0) call SetPlayerTeam(Player(2),0) call SetPlayerTeam(Player(3),0) call SetPlayerTeam(Player(4),0) call SetPlayerTeam(Player(5),0) call SetPlayerTeam(Player(6),0) call SetPlayerTeam(Player(7),0) call SetPlayerTeam(Player(8),0) call SetPlayerTeam(Player(9),0) call SetPlayerAllianceStateAllyBJ(Player(0),Player(1),true) call SetPlayerAllianceStateAllyBJ(Player(0),Player(2),true) call SetPlayerAllianceStateAllyBJ(Player(0),Player(3),true) call SetPlayerAllianceStateAllyBJ(Player(0),Player(4),true) call SetPlayerAllianceStateAllyBJ(Player(0),Player(5),true) call SetPlayerAllianceStateAllyBJ(Player(0),Player(6),true) call SetPlayerAllianceStateAllyBJ(Player(0),Player(7),true) call SetPlayerAllianceStateAllyBJ(Player(0),Player(8),true) call SetPlayerAllianceStateAllyBJ(Player(0),Player(9),true) call SetPlayerAllianceStateAllyBJ(Player(1),Player(0),true) call SetPlayerAllianceStateAllyBJ(Player(1),Player(2),true) call SetPlayerAllianceStateAllyBJ(Player(1),Player(3),true) call SetPlayerAllianceStateAllyBJ(Player(1),Player(4),true) call SetPlayerAllianceStateAllyBJ(Player(1),Player(5),true) call SetPlayerAllianceStateAllyBJ(Player(1),Player(6),true) call SetPlayerAllianceStateAllyBJ(Player(1),Player(7),true) call SetPlayerAllianceStateAllyBJ(Player(1),Player(8),true) call SetPlayerAllianceStateAllyBJ(Player(1),Player(9),true) call SetPlayerAllianceStateAllyBJ(Player(2),Player(0),true) call SetPlayerAllianceStateAllyBJ(Player(2),Player(1),true) call SetPlayerAllianceStateAllyBJ(Player(2),Player(3),true) call SetPlayerAllianceStateAllyBJ(Player(2),Player(4),true) call SetPlayerAllianceStateAllyBJ(Player(2),Player(5),true) call SetPlayerAllianceStateAllyBJ(Player(2),Player(6),true) call SetPlayerAllianceStateAllyBJ(Player(2),Player(7),true) call SetPlayerAllianceStateAllyBJ(Player(2),Player(8),true) call SetPlayerAllianceStateAllyBJ(Player(2),Player(9),true) call SetPlayerAllianceStateAllyBJ(Player(3),Player(0),true) call SetPlayerAllianceStateAllyBJ(Player(3),Player(1),true) call SetPlayerAllianceStateAllyBJ(Player(3),Player(2),true) call SetPlayerAllianceStateAllyBJ(Player(3),Player(4),true) call SetPlayerAllianceStateAllyBJ(Player(3),Player(5),true) call SetPlayerAllianceStateAllyBJ(Player(3),Player(6),true) call SetPlayerAllianceStateAllyBJ(Player(3),Player(7),true) call SetPlayerAllianceStateAllyBJ(Player(3),Player(8),true) call SetPlayerAllianceStateAllyBJ(Player(3),Player(9),true) call SetPlayerAllianceStateAllyBJ(Player(4),Player(0),true) call SetPlayerAllianceStateAllyBJ(Player(4),Player(1),true) call SetPlayerAllianceStateAllyBJ(Player(4),Player(2),true) call SetPlayerAllianceStateAllyBJ(Player(4),Player(3),true) call SetPlayerAllianceStateAllyBJ(Player(4),Player(5),true) call SetPlayerAllianceStateAllyBJ(Player(4),Player(6),true) call SetPlayerAllianceStateAllyBJ(Player(4),Player(7),true) call SetPlayerAllianceStateAllyBJ(Player(4),Player(8),true) call SetPlayerAllianceStateAllyBJ(Player(4),Player(9),true) call SetPlayerAllianceStateAllyBJ(Player(5),Player(0),true) call SetPlayerAllianceStateAllyBJ(Player(5),Player(1),true) call SetPlayerAllianceStateAllyBJ(Player(5),Player(2),true) call SetPlayerAllianceStateAllyBJ(Player(5),Player(3),true) call SetPlayerAllianceStateAllyBJ(Player(5),Player(4),true) call SetPlayerAllianceStateAllyBJ(Player(5),Player(6),true) call SetPlayerAllianceStateAllyBJ(Player(5),Player(7),true) call SetPlayerAllianceStateAllyBJ(Player(5),Player(8),true) call SetPlayerAllianceStateAllyBJ(Player(5),Player(9),true) call SetPlayerAllianceStateAllyBJ(Player(6),Player(0),true) call SetPlayerAllianceStateAllyBJ(Player(6),Player(1),true) call SetPlayerAllianceStateAllyBJ(Player(6),Player(2),true) call SetPlayerAllianceStateAllyBJ(Player(6),Player(3),true) call SetPlayerAllianceStateAllyBJ(Player(6),Player(4),true) call SetPlayerAllianceStateAllyBJ(Player(6),Player(5),true) call SetPlayerAllianceStateAllyBJ(Player(6),Player(7),true) call SetPlayerAllianceStateAllyBJ(Player(6),Player(8),true) call SetPlayerAllianceStateAllyBJ(Player(6),Player(9),true) call SetPlayerAllianceStateAllyBJ(Player(7),Player(0),true) call SetPlayerAllianceStateAllyBJ(Player(7),Player(1),true) call SetPlayerAllianceStateAllyBJ(Player(7),Player(2),true) call SetPlayerAllianceStateAllyBJ(Player(7),Player(3),true) call SetPlayerAllianceStateAllyBJ(Player(7),Player(4),true) call SetPlayerAllianceStateAllyBJ(Player(7),Player(5),true) call SetPlayerAllianceStateAllyBJ(Player(7),Player(6),true) call SetPlayerAllianceStateAllyBJ(Player(7),Player(8),true) call SetPlayerAllianceStateAllyBJ(Player(7),Player(9),true) call SetPlayerAllianceStateAllyBJ(Player(8),Player(0),true) call SetPlayerAllianceStateAllyBJ(Player(8),Player(1),true) call SetPlayerAllianceStateAllyBJ(Player(8),Player(2),true) call SetPlayerAllianceStateAllyBJ(Player(8),Player(3),true) call SetPlayerAllianceStateAllyBJ(Player(8),Player(4),true) call SetPlayerAllianceStateAllyBJ(Player(8),Player(5),true) call SetPlayerAllianceStateAllyBJ(Player(8),Player(6),true) call SetPlayerAllianceStateAllyBJ(Player(8),Player(7),true) call SetPlayerAllianceStateAllyBJ(Player(8),Player(9),true) call SetPlayerAllianceStateAllyBJ(Player(9),Player(0),true) call SetPlayerAllianceStateAllyBJ(Player(9),Player(1),true) call SetPlayerAllianceStateAllyBJ(Player(9),Player(2),true) call SetPlayerAllianceStateAllyBJ(Player(9),Player(3),true) call SetPlayerAllianceStateAllyBJ(Player(9),Player(4),true) call SetPlayerAllianceStateAllyBJ(Player(9),Player(5),true) call SetPlayerAllianceStateAllyBJ(Player(9),Player(6),true) call SetPlayerAllianceStateAllyBJ(Player(9),Player(7),true) call SetPlayerAllianceStateAllyBJ(Player(9),Player(8),true) call SetPlayerAllianceStateVisionBJ(Player(0),Player(1),true) call SetPlayerAllianceStateVisionBJ(Player(0),Player(2),true) call SetPlayerAllianceStateVisionBJ(Player(0),Player(3),true) call SetPlayerAllianceStateVisionBJ(Player(0),Player(4),true) call SetPlayerAllianceStateVisionBJ(Player(0),Player(5),true) call SetPlayerAllianceStateVisionBJ(Player(0),Player(6),true) call SetPlayerAllianceStateVisionBJ(Player(0),Player(7),true) call SetPlayerAllianceStateVisionBJ(Player(0),Player(8),true) call SetPlayerAllianceStateVisionBJ(Player(0),Player(9),true) call SetPlayerAllianceStateVisionBJ(Player(1),Player(0),true) call SetPlayerAllianceStateVisionBJ(Player(1),Player(2),true) call SetPlayerAllianceStateVisionBJ(Player(1),Player(3),true) call SetPlayerAllianceStateVisionBJ(Player(1),Player(4),true) call SetPlayerAllianceStateVisionBJ(Player(1),Player(5),true) call SetPlayerAllianceStateVisionBJ(Player(1),Player(6),true) call SetPlayerAllianceStateVisionBJ(Player(1),Player(7),true) call SetPlayerAllianceStateVisionBJ(Player(1),Player(8),true) call SetPlayerAllianceStateVisionBJ(Player(1),Player(9),true) call SetPlayerAllianceStateVisionBJ(Player(2),Player(0),true) call SetPlayerAllianceStateVisionBJ(Player(2),Player(1),true) call SetPlayerAllianceStateVisionBJ(Player(2),Player(3),true) call SetPlayerAllianceStateVisionBJ(Player(2),Player(4),true) call SetPlayerAllianceStateVisionBJ(Player(2),Player(5),true) call SetPlayerAllianceStateVisionBJ(Player(2),Player(6),true) call SetPlayerAllianceStateVisionBJ(Player(2),Player(7),true) call SetPlayerAllianceStateVisionBJ(Player(2),Player(8),true) call SetPlayerAllianceStateVisionBJ(Player(2),Player(9),true) call SetPlayerAllianceStateVisionBJ(Player(3),Player(0),true) call SetPlayerAllianceStateVisionBJ(Player(3),Player(1),true) call SetPlayerAllianceStateVisionBJ(Player(3),Player(2),true) call SetPlayerAllianceStateVisionBJ(Player(3),Player(4),true) call SetPlayerAllianceStateVisionBJ(Player(3),Player(5),true) call SetPlayerAllianceStateVisionBJ(Player(3),Player(6),true) call SetPlayerAllianceStateVisionBJ(Player(3),Player(7),true) call SetPlayerAllianceStateVisionBJ(Player(3),Player(8),true) call SetPlayerAllianceStateVisionBJ(Player(3),Player(9),true) call SetPlayerAllianceStateVisionBJ(Player(4),Player(0),true) call SetPlayerAllianceStateVisionBJ(Player(4),Player(1),true) call SetPlayerAllianceStateVisionBJ(Player(4),Player(2),true) call SetPlayerAllianceStateVisionBJ(Player(4),Player(3),true) call SetPlayerAllianceStateVisionBJ(Player(4),Player(5),true) call SetPlayerAllianceStateVisionBJ(Player(4),Player(6),true) call SetPlayerAllianceStateVisionBJ(Player(4),Player(7),true) call SetPlayerAllianceStateVisionBJ(Player(4),Player(8),true) call SetPlayerAllianceStateVisionBJ(Player(4),Player(9),true) call SetPlayerAllianceStateVisionBJ(Player(5),Player(0),true) call SetPlayerAllianceStateVisionBJ(Player(5),Player(1),true) call SetPlayerAllianceStateVisionBJ(Player(5),Player(2),true) call SetPlayerAllianceStateVisionBJ(Player(5),Player(3),true) call SetPlayerAllianceStateVisionBJ(Player(5),Player(4),true) call SetPlayerAllianceStateVisionBJ(Player(5),Player(6),true) call SetPlayerAllianceStateVisionBJ(Player(5),Player(7),true) call SetPlayerAllianceStateVisionBJ(Player(5),Player(8),true) call SetPlayerAllianceStateVisionBJ(Player(5),Player(9),true) call SetPlayerAllianceStateVisionBJ(Player(6),Player(0),true) call SetPlayerAllianceStateVisionBJ(Player(6),Player(1),true) call SetPlayerAllianceStateVisionBJ(Player(6),Player(2),true) call SetPlayerAllianceStateVisionBJ(Player(6),Player(3),true) call SetPlayerAllianceStateVisionBJ(Player(6),Player(4),true) call SetPlayerAllianceStateVisionBJ(Player(6),Player(5),true) call SetPlayerAllianceStateVisionBJ(Player(6),Player(7),true) call SetPlayerAllianceStateVisionBJ(Player(6),Player(8),true) call SetPlayerAllianceStateVisionBJ(Player(6),Player(9),true) call SetPlayerAllianceStateVisionBJ(Player(7),Player(0),true) call SetPlayerAllianceStateVisionBJ(Player(7),Player(1),true) call SetPlayerAllianceStateVisionBJ(Player(7),Player(2),true) call SetPlayerAllianceStateVisionBJ(Player(7),Player(3),true) call SetPlayerAllianceStateVisionBJ(Player(7),Player(4),true) call SetPlayerAllianceStateVisionBJ(Player(7),Player(5),true) call SetPlayerAllianceStateVisionBJ(Player(7),Player(6),true) call SetPlayerAllianceStateVisionBJ(Player(7),Player(8),true) call SetPlayerAllianceStateVisionBJ(Player(7),Player(9),true) call SetPlayerAllianceStateVisionBJ(Player(8),Player(0),true) call SetPlayerAllianceStateVisionBJ(Player(8),Player(1),true) call SetPlayerAllianceStateVisionBJ(Player(8),Player(2),true) call SetPlayerAllianceStateVisionBJ(Player(8),Player(3),true) call SetPlayerAllianceStateVisionBJ(Player(8),Player(4),true) call SetPlayerAllianceStateVisionBJ(Player(8),Player(5),true) call SetPlayerAllianceStateVisionBJ(Player(8),Player(6),true) call SetPlayerAllianceStateVisionBJ(Player(8),Player(7),true) call SetPlayerAllianceStateVisionBJ(Player(8),Player(9),true) call SetPlayerAllianceStateVisionBJ(Player(9),Player(0),true) call SetPlayerAllianceStateVisionBJ(Player(9),Player(1),true) call SetPlayerAllianceStateVisionBJ(Player(9),Player(2),true) call SetPlayerAllianceStateVisionBJ(Player(9),Player(3),true) call SetPlayerAllianceStateVisionBJ(Player(9),Player(4),true) call SetPlayerAllianceStateVisionBJ(Player(9),Player(5),true) call SetPlayerAllianceStateVisionBJ(Player(9),Player(6),true) call SetPlayerAllianceStateVisionBJ(Player(9),Player(7),true) call SetPlayerAllianceStateVisionBJ(Player(9),Player(8),true) call SetPlayerTeam(Player(10),1) call SetPlayerTeam(Player(11),1) call SetPlayerAllianceStateAllyBJ(Player(10),Player(11),true) call SetPlayerAllianceStateAllyBJ(Player(11),Player(10),true) call SetPlayerAllianceStateVisionBJ(Player(10),Player(11),true) call SetPlayerAllianceStateVisionBJ(Player(11),Player(10),true) endfunction function InitAllyPriorities takes nothing returns nothing call SetStartLocPrioCount(0,9) call SetStartLocPrio(0,0,1,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(0,1,2,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(0,2,3,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(0,3,4,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(0,4,5,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(0,5,6,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(0,6,7,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(0,7,8,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(0,8,9,MAP_LOC_PRIO_HIGH) call SetStartLocPrioCount(1,10) call SetStartLocPrio(1,0,0,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(1,1,2,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(1,2,3,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(1,3,4,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(1,4,5,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(1,5,6,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(1,6,7,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(1,7,8,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(1,8,9,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(1,9,10,MAP_LOC_PRIO_HIGH) call SetStartLocPrioCount(2,10) call SetStartLocPrio(2,0,0,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(2,1,1,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(2,2,3,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(2,3,4,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(2,4,5,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(2,5,6,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(2,6,7,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(2,7,8,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(2,8,9,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(2,9,10,MAP_LOC_PRIO_HIGH) call SetStartLocPrioCount(3,10) call SetStartLocPrio(3,0,0,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(3,1,1,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(3,2,2,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(3,3,4,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(3,4,5,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(3,5,6,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(3,6,7,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(3,7,8,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(3,8,9,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(3,9,10,MAP_LOC_PRIO_HIGH) call SetStartLocPrioCount(4,10) call SetStartLocPrio(4,0,0,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(4,1,1,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(4,2,2,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(4,3,3,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(4,4,5,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(4,5,6,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(4,6,7,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(4,7,8,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(4,8,9,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(4,9,10,MAP_LOC_PRIO_HIGH) call SetStartLocPrioCount(5,10) call SetStartLocPrio(5,0,0,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(5,1,1,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(5,2,2,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(5,3,3,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(5,4,4,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(5,5,6,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(5,6,7,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(5,7,8,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(5,8,9,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(5,9,10,MAP_LOC_PRIO_HIGH) call SetStartLocPrioCount(6,10) call SetStartLocPrio(6,0,0,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(6,1,1,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(6,2,2,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(6,3,3,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(6,4,4,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(6,5,5,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(6,6,7,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(6,7,8,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(6,8,9,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(6,9,10,MAP_LOC_PRIO_HIGH) call SetStartLocPrioCount(7,10) call SetStartLocPrio(7,0,0,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(7,1,1,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(7,2,2,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(7,3,3,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(7,4,4,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(7,5,5,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(7,6,6,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(7,7,8,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(7,8,9,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(7,9,10,MAP_LOC_PRIO_HIGH) call SetStartLocPrioCount(8,10) call SetStartLocPrio(8,0,0,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(8,1,1,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(8,2,2,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(8,3,3,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(8,4,4,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(8,5,5,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(8,6,6,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(8,7,7,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(8,8,9,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(8,9,10,MAP_LOC_PRIO_HIGH) call SetStartLocPrioCount(9,10) call SetStartLocPrio(9,0,0,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(9,1,1,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(9,2,2,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(9,3,3,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(9,4,4,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(9,5,5,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(9,6,6,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(9,7,7,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(9,8,8,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(9,9,10,MAP_LOC_PRIO_HIGH) call SetStartLocPrioCount(10,9) call SetStartLocPrio(10,0,1,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(10,1,2,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(10,2,3,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(10,3,4,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(10,4,5,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(10,5,6,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(10,6,7,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(10,7,8,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(10,8,9,MAP_LOC_PRIO_HIGH) call SetStartLocPrioCount(11,10) call SetStartLocPrio(11,0,0,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(11,1,1,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(11,2,2,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(11,3,3,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(11,4,4,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(11,5,5,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(11,6,6,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(11,7,7,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(11,8,8,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(11,9,9,MAP_LOC_PRIO_HIGH) endfunction function gameStarted takes nothing returns nothing call ExecuteFunc("Multiboard__InitMultiboard") call InitCustomTriggers() call libBase__StartTime() call RunInitializationTriggers() endfunction function StartingGame takes nothing returns nothing local timer t=GetExpiredTimer() local integer id=GetHandleId(t) local integer i=LoadInteger(libHandleVars__ht,id,HASH_ATTACH0) if i>0 then call DisplayTextToPlayer(GetLocalPlayer(),0,0,I2S(i)+"...") call SaveInteger(libHandleVars__ht,id,HASH_ATTACH0,i-1) else call ClearTextMessages() call DisplayTextToPlayer(GetLocalPlayer(),0,0,"Go!") call gameStarted() call PauseTimer(t) call DestroyTimer(t) endif endfunction function StartGame takes nothing returns nothing local timer t=CreateTimer() call InitCustomFirstTriggers() call SaveInteger(libHandleVars__ht,GetHandleId(t),HASH_ATTACH0,3) call TimerStart(t,1,true,function StartingGame) set t=null endfunction function selectedVamp takes player p,boolean inform returns nothing local integer i=0 if s__PlayerStruct_state[players[GetPlayerId(p)]]==STATE_PLAYING then set s__PlayerStruct_side[players[GetPlayerId(p)]]=SIDE_VAMPIRE if inform then call DisplayTextToPlayer(GetLocalPlayer(),0,0,"Selected vampire: "+GetPlayerNameColored(p)) endif loop exitwhen i>11 if s__PlayerStruct_side[players[i]]!=SIDE_VAMPIRE then call makeEnemy(p,Player(i)) endif set i=i+1 endloop endif endfunction function initVamps takes nothing returns nothing local integer needVamps=0 local integer playerNum=0 local player newVamp local integer i=0 local integer k=0 local force allPlayers=CreateForce() local timer t=GetExpiredTimer() call DialogDisplay(GetLocalPlayer(),dialogForWantVamps,false) call DialogDestroy(dialogForWantVamps) loop exitwhen i>11 if s__PlayerStruct_state[players[i]]==STATE_PLAYING then set playerNum=playerNum+1 call ForceAddPlayer(allPlayers,Player(i)) endif set i=i+1 endloop if playerNum>7 then set needVamps=2 else set needVamps=1 endif set i=0 loop exitwhen i>=needVamps or i>=wants_Play_Vamp_Num set newVamp=ForcePickRandomPlayer(wants_Play_Vamp) call ForceRemovePlayer(wants_Play_Vamp,newVamp) call selectedVamp(newVamp,true) set i=i+1 endloop if wants_Play_Vamp_Num<needVamps then set i=0 loop exitwhen i>=needVamps-wants_Play_Vamp_Num set newVamp=ForcePickRandomPlayer(allPlayers) call ForceAddPlayer(allPlayers,newVamp) call selectedVamp(newVamp,true) set i=i+1 endloop endif call StartGame() set allPlayers=null set newVamp=null call TimerDialogDisplay(td_want_vamp,false) call DestroyTimerDialog(td_want_vamp) call PauseTimer(t) call DestroyTimer(t) set t=null set dialogForWantVamps=null endfunction function dialogForWantVampsClicked takes nothing returns boolean local player p=GetTriggerPlayer() if GetClickedButton()==button_Want_Vamp then call ForceAddPlayer(wants_Play_Vamp,p) set wants_Play_Vamp_Num=wants_Play_Vamp_Num+1 call DisplayTextToPlayer(GetLocalPlayer(),0,0,GetPlayerNameColored(p)+" wants to play as Vampire") endif set clicked_button=clicked_button+1 return false endfunction function showWantVampsDialog takes nothing returns nothing local trigger trig_show_dialog=CreateTrigger() local player p=GetLocalPlayer() set dialogForWantVamps=DialogCreate() call DialogClear(dialogForWantVamps) call DialogSetMessage(dialogForWantVamps,"Do you want to play as vampire?") call DialogAddButton(dialogForWantVamps,"No",0) set button_Want_Vamp=DialogAddButton(dialogForWantVamps,"Yes",0) call DialogDisplay(p,dialogForWantVamps,true) call TriggerRegisterDialogEvent(trig_show_dialog,dialogForWantVamps) call TriggerAddCondition(trig_show_dialog,Condition(function dialogForWantVampsClicked)) set p=null endfunction function initFindVamps takes nothing returns nothing local trigger trig=CreateTrigger() local timer t=CreateTimer() set wants_Play_Vamp=CreateForce() call showWantVampsDialog() set td_want_vamp=CreateTimerDialog(t) call TimerStart(t,5.00,false,function initVamps) call TimerDialogSetTitle(td_want_vamp,"Vote time") call TimerDialogSetTimeColor(td_want_vamp,255,4,4,255) call TimerDialogDisplay(td_want_vamp,true) set trig=null endfunction function dialogVampsModeClicked takes nothing returns boolean if GetClickedButton()==defaultVamps then call DisplayTextToPlayer(GetLocalPlayer(),0,0,"Default Vampires Mode") call selectedVamp(Player(10),false) call selectedVamp(Player(11),false) call StartGame() elseif GetClickedButton()==randomVamps then call DisplayTextToPlayer(GetLocalPlayer(),0,0,"Random Vampires Mode") call initFindVamps() endif return false endfunction function initVampsMode takes nothing returns boolean local trigger trig=CreateTrigger() if(IsPlayerInForce(GetLocalPlayer(),bj_FORCE_ALL_PLAYERS))then call DisplayTextToPlayer(GetLocalPlayer(),0,0,"Wait while "+GetPlayerNameColored(Player(0))+" picks the mode.") endif set dialogForVampsMode=DialogCreate() call DialogClear(dialogForVampsMode) call DialogSetMessage(dialogForVampsMode,"How to select vamps?") set defaultVamps=DialogAddButton(dialogForVampsMode,"Default Vampires",0) set randomVamps=DialogAddButton(dialogForVampsMode,"Random Vampires",0) call DialogDisplay(Player(0),dialogForVampsMode,true) call TriggerRegisterDialogEvent(trig,dialogForVampsMode) call TriggerAddCondition(trig,Condition(function dialogVampsModeClicked)) return false endfunction function letsGo takes nothing returns nothing local trigger trig=CreateTrigger() call TriggerRegisterTimerEvent(trig,0.50,false) call TriggerAddCondition(trig,Condition(function initVampsMode)) endfunction function runInitTriggers takes nothing returns nothing if DISABLED>0 then call InitTrig_initBases() endif call InitTrig_initQuests() call InitTrig_initUnits() call InitTrig_preloadUnits() call InitTrig_initMisc() call InitTrig_messages() call InitTrig_afk() call InitTrig_sendResources() call InitTrig_nomini() call InitTrig_bases() call InitTrig_clear() call InitTrig_setname() call InitTrig_show() call InitTrig_newCommands() call InitTrig_kick() call InitTrig_stopAttack() call InitTrig_slayerMove() call InitTrig_upgradeFix() call InitTrig_itemSys() call InitTrig_Critical() call InitTrig_CalciteOutpost() call InitTrig_tips() call InitTrig_autoharvest() call InitTrig_itemAcquire() call InitTrig_playerLeaves() call InitTrig_selectVampires() call InitTrig_shareControl() call InitTrig_unitCasts() call InitTrig_unitDies() call InitTrig_unitEnters() call InitTrig_unitRevives() call InitTrig_unitTeleport() call InitTrig_vampireResearch() call InitTrig_victoryHuman() call InitTrig_victoryVampire() call InitTrig_humanResearch() call InitTrig_vampireSpells() call InitTrig_humanSpells() endfunction function main takes nothing returns boolean local weathereffect we local trigger trg local player p local unit u local integer unitID local trigger t local real life local integer b local integer i local integer j local fogmodifier fm local boolean ally local boolean continue=true if not continue then return false endif call SetCameraBounds(-8192.+GetCameraMargin(CAMERA_MARGIN_LEFT),-8192.+GetCameraMargin(CAMERA_MARGIN_BOTTOM),8192.-GetCameraMargin(CAMERA_MARGIN_RIGHT),8192.-GetCameraMargin(CAMERA_MARGIN_TOP),-8192.+GetCameraMargin(CAMERA_MARGIN_LEFT),8192.-GetCameraMargin(CAMERA_MARGIN_TOP),8192.-GetCameraMargin(CAMERA_MARGIN_RIGHT),-8192.+GetCameraMargin(CAMERA_MARGIN_BOTTOM)) call SetDayNightModels("Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdl","Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdl") call SetWaterBaseColor(0,128,128,255) call NewSoundEnvironment("Default") call SetAmbientDaySound("LordaeronSummerDay") call SetAmbientNightSound("LordaeronSummerNight") call SetMapMusic("Music",true,0) call InitSounds() call CreateRegions() call CreateAllUnits() call InitBlizzard() call InitGlobals() call ExecuteFunc("jasshelper__initstructs41917265") call ExecuteFunc("libColor__OnInit") call ExecuteFunc("libHandleVars__OnInit") call ExecuteFunc("libBase__OnInit") call ExecuteFunc("libUnitSystem__OnInit") call ExecuteFunc("region__OnInit") call ExecuteFunc("libBaseClaims__OnInit") call ExecuteFunc("skins__OnInit") call ExecuteFunc("BloodTower__OnInit") call ExecuteFunc("Multiplier__OnInit") call InitTrig_initPrePlayers() call runInitTriggers() call letsGo() return true endfunction function config takes nothing returns nothing call SetMapName("Increases the attack damage of all Pink Diamond Towers by 300.") call SetMapDescription("") call SetPlayers(12) call SetTeams(12) call SetGamePlacement(MAP_PLACEMENT_TEAMS_TOGETHER) call DefineStartLocation(0,-256.,-1472.) call DefineStartLocation(1,-256.,-1472.) call DefineStartLocation(2,-256.,-1472.) call DefineStartLocation(3,-256.,-1472.) call DefineStartLocation(4,-256.,-1472.) call DefineStartLocation(5,-256.,-1472.) call DefineStartLocation(6,-256.,-1472.) call DefineStartLocation(7,-256.,-1472.) call DefineStartLocation(8,-256.,-1472.) call DefineStartLocation(9,-256.,-1472.) call DefineStartLocation(10,-256.,-1472.) call DefineStartLocation(11,-256.,-1472.) call SetPlayerStartLocation(Player(0),0) call ForcePlayerStartLocation(Player(0),0) call SetPlayerColor(Player(0),ConvertPlayerColor(0)) call SetPlayerRacePreference(Player(0),RACE_PREF_HUMAN) call SetPlayerRaceSelectable(Player(0),false) call SetPlayerController(Player(0),MAP_CONTROL_USER) call SetPlayerStartLocation(Player(1),1) call ForcePlayerStartLocation(Player(1),1) call SetPlayerColor(Player(1),ConvertPlayerColor(1)) call SetPlayerRacePreference(Player(1),RACE_PREF_HUMAN) call SetPlayerRaceSelectable(Player(1),false) call SetPlayerController(Player(1),MAP_CONTROL_USER) call SetPlayerStartLocation(Player(2),2) call ForcePlayerStartLocation(Player(2),2) call SetPlayerColor(Player(2),ConvertPlayerColor(2)) call SetPlayerRacePreference(Player(2),RACE_PREF_HUMAN) call SetPlayerRaceSelectable(Player(2),false) call SetPlayerController(Player(2),MAP_CONTROL_USER) call SetPlayerStartLocation(Player(3),3) call ForcePlayerStartLocation(Player(3),3) call SetPlayerColor(Player(3),ConvertPlayerColor(3)) call SetPlayerRacePreference(Player(3),RACE_PREF_HUMAN) call SetPlayerRaceSelectable(Player(3),false) call SetPlayerController(Player(3),MAP_CONTROL_USER) call SetPlayerStartLocation(Player(4),4) call ForcePlayerStartLocation(Player(4),4) call SetPlayerColor(Player(4),ConvertPlayerColor(4)) call SetPlayerRacePreference(Player(4),RACE_PREF_HUMAN) call SetPlayerRaceSelectable(Player(4),false) call SetPlayerController(Player(4),MAP_CONTROL_USER) call SetPlayerStartLocation(Player(5),5) call ForcePlayerStartLocation(Player(5),5) call SetPlayerColor(Player(5),ConvertPlayerColor(5)) call SetPlayerRacePreference(Player(5),RACE_PREF_HUMAN) call SetPlayerRaceSelectable(Player(5),false) call SetPlayerController(Player(5),MAP_CONTROL_USER) call SetPlayerStartLocation(Player(6),6) call ForcePlayerStartLocation(Player(6),6) call SetPlayerColor(Player(6),ConvertPlayerColor(6)) call SetPlayerRacePreference(Player(6),RACE_PREF_HUMAN) call SetPlayerRaceSelectable(Player(6),false) call SetPlayerController(Player(6),MAP_CONTROL_USER) call SetPlayerStartLocation(Player(7),7) call ForcePlayerStartLocation(Player(7),7) call SetPlayerColor(Player(7),ConvertPlayerColor(7)) call SetPlayerRacePreference(Player(7),RACE_PREF_HUMAN) call SetPlayerRaceSelectable(Player(7),false) call SetPlayerController(Player(7),MAP_CONTROL_USER) call SetPlayerStartLocation(Player(8),8) call ForcePlayerStartLocation(Player(8),8) call SetPlayerColor(Player(8),ConvertPlayerColor(8)) call SetPlayerRacePreference(Player(8),RACE_PREF_HUMAN) call SetPlayerRaceSelectable(Player(8),false) call SetPlayerController(Player(8),MAP_CONTROL_USER) call SetPlayerStartLocation(Player(9),9) call ForcePlayerStartLocation(Player(9),9) call SetPlayerColor(Player(9),ConvertPlayerColor(9)) call SetPlayerRacePreference(Player(9),RACE_PREF_HUMAN) call SetPlayerRaceSelectable(Player(9),false) call SetPlayerController(Player(9),MAP_CONTROL_USER) call SetPlayerStartLocation(Player(10),10) call ForcePlayerStartLocation(Player(10),10) call SetPlayerColor(Player(10),ConvertPlayerColor(10)) call SetPlayerRacePreference(Player(10),RACE_PREF_UNDEAD) call SetPlayerRaceSelectable(Player(10),false) call SetPlayerController(Player(10),MAP_CONTROL_USER) call SetPlayerStartLocation(Player(11),11) call ForcePlayerStartLocation(Player(11),11) call SetPlayerColor(Player(11),ConvertPlayerColor(11)) call SetPlayerRacePreference(Player(11),RACE_PREF_UNDEAD) call SetPlayerRaceSelectable(Player(11),false) call SetPlayerController(Player(11),MAP_CONTROL_USER) call InitCustomTeams() call SetStartLocPrioCount(0,9) call SetStartLocPrio(0,0,1,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(0,1,2,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(0,2,3,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(0,3,4,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(0,4,5,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(0,5,6,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(0,6,7,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(0,7,8,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(0,8,9,MAP_LOC_PRIO_HIGH) call SetStartLocPrioCount(1,10) call SetStartLocPrio(1,0,0,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(1,1,2,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(1,2,3,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(1,3,4,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(1,4,5,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(1,5,6,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(1,6,7,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(1,7,8,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(1,8,9,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(1,9,10,MAP_LOC_PRIO_HIGH) call SetStartLocPrioCount(2,10) call SetStartLocPrio(2,0,0,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(2,1,1,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(2,2,3,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(2,3,4,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(2,4,5,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(2,5,6,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(2,6,7,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(2,7,8,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(2,8,9,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(2,9,10,MAP_LOC_PRIO_HIGH) call SetStartLocPrioCount(3,10) call SetStartLocPrio(3,0,0,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(3,1,1,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(3,2,2,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(3,3,4,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(3,4,5,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(3,5,6,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(3,6,7,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(3,7,8,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(3,8,9,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(3,9,10,MAP_LOC_PRIO_HIGH) call SetStartLocPrioCount(4,10) call SetStartLocPrio(4,0,0,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(4,1,1,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(4,2,2,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(4,3,3,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(4,4,5,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(4,5,6,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(4,6,7,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(4,7,8,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(4,8,9,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(4,9,10,MAP_LOC_PRIO_HIGH) call SetStartLocPrioCount(5,10) call SetStartLocPrio(5,0,0,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(5,1,1,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(5,2,2,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(5,3,3,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(5,4,4,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(5,5,6,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(5,6,7,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(5,7,8,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(5,8,9,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(5,9,10,MAP_LOC_PRIO_HIGH) call SetStartLocPrioCount(6,10) call SetStartLocPrio(6,0,0,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(6,1,1,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(6,2,2,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(6,3,3,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(6,4,4,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(6,5,5,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(6,6,7,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(6,7,8,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(6,8,9,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(6,9,10,MAP_LOC_PRIO_HIGH) call SetStartLocPrioCount(7,10) call SetStartLocPrio(7,0,0,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(7,1,1,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(7,2,2,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(7,3,3,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(7,4,4,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(7,5,5,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(7,6,6,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(7,7,8,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(7,8,9,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(7,9,10,MAP_LOC_PRIO_HIGH) call SetStartLocPrioCount(8,10) call SetStartLocPrio(8,0,0,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(8,1,1,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(8,2,2,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(8,3,3,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(8,4,4,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(8,5,5,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(8,6,6,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(8,7,7,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(8,8,9,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(8,9,10,MAP_LOC_PRIO_HIGH) call SetStartLocPrioCount(9,10) call SetStartLocPrio(9,0,0,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(9,1,1,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(9,2,2,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(9,3,3,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(9,4,4,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(9,5,5,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(9,6,6,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(9,7,7,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(9,8,8,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(9,9,10,MAP_LOC_PRIO_HIGH) call SetStartLocPrioCount(10,9) call SetStartLocPrio(10,0,1,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(10,1,2,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(10,2,3,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(10,3,4,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(10,4,5,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(10,5,6,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(10,6,7,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(10,7,8,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(10,8,9,MAP_LOC_PRIO_HIGH) call SetStartLocPrioCount(11,10) call SetStartLocPrio(11,0,0,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(11,1,1,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(11,2,2,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(11,3,3,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(11,4,4,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(11,5,5,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(11,6,6,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(11,7,7,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(11,8,8,MAP_LOC_PRIO_HIGH) call SetStartLocPrio(11,9,9,MAP_LOC_PRIO_HIGH) endfunction
_________________ Add me on Discord Username: Xirizo#7777 , I love cheating wc3 maps and spreading my influence ;p
Users browsing this forum: No registered users and 21 guests
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum