// Map header custom code
// SimError by Vexorian at wc3c.net
// Sim Error (modified)
function CSS_SimError takes string s returns nothing
local string msg = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00" + s + "|r"
local player ForPlayer = GetTriggerPlayer()
local sound error = CreateSoundFromLabel("InterfaceError", false, false, false, 10, 10)
if GetLocalPlayer() == ForPlayer then
call ClearTextMessages()
call DisplayTimedTextToPlayer(ForPlayer, 0.52, 0.96, 2.00, msg)
call StartSound(error)
endif
set ForPlayer = null
endfunction
function CSS_SimNotification takes string s returns nothing
local string msg = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cff32cd32" + s + "|r"
local player ForPlayer = GetTriggerPlayer()
local sound notify = CreateSoundFromLabel("ItemReward", false, false, false, 10, 10)
if GetLocalPlayer() == ForPlayer then
call ClearTextMessages()
call DisplayTimedTextToPlayer(ForPlayer, 0.52, 0.96, 2.00, msg)
call StartSound (notify)
endif
set ForPlayer = null
endfunction
// Bound Int by Magtheridon96 at hiveworkshop.com
// BoundInt
function BoundInt takes integer i, integer min, integer max returns integer
return IMaxBJ(IMinBJ(i, max), min)
endfunction
// Bonus Handling Code
function CSS_AddBonus takes unit u, integer amount, integer bonusType returns nothing
local integer max = udg_CSS_Power[17]
local integer min = -udg_CSS_Power[17]
local integer i = 16
local integer j = LoadInteger (udg_CSS_Hashtable, GetHandleId(u), bonusType)
if amount > max - 1 or amount < min then
call CSS_SimError ("Value too high or too low")
return
endif
if amount + j >= max or amount + j <= min then
call CSS_SimError ("Current value at maximum or minimum")
return
endif
set amount = amount + j
call BoundInt (amount, min, max - 1)
if bonusType < 0 or bonusType > 10 then
call CSS_SimError ("CSS Error: Invalid bonus type (" + I2S(bonusType) + ")")
return
elseif bonusType == 8 or bonusType == 9 then
if bonusType == 8 and amount*1. + GetUnitState(u, UNIT_STATE_MAX_LIFE) <= 0 then
call CSS_SimError ("Unit's current max life is lower than the negative bonus amount. Unable to subtract.")
return
elseif bonusType == 9 and amount*1. + GetUnitState(u, UNIT_STATE_MAX_MANA) <= 0 then
call CSS_SimError ("Unit's current max mana is lower than the negative bonus amount. Unable to subtract.")
return
endif
call SaveInteger(udg_CSS_Hashtable, GetHandleId(u), bonusType, amount)
if amount < 0 then
set amount = max + amount
else
call UnitRemoveAbility(u, udg_CSS_Abilities[(bonusType + 1)*18 - 1])
endif
loop
if amount >= udg_CSS_Power[i] then
call UnitAddAbility(u, udg_CSS_Abilities[bonusType*18 + i])
call UnitMakeAbilityPermanent(u, true, udg_CSS_Abilities[bonusType*18 + i])
set amount = amount - udg_CSS_Power[i]
else
call UnitRemoveAbility(u, udg_CSS_Abilities[bonusType*18 + i])
endif
set i = i - 1
exitwhen i < 0
endloop
if LoadInteger(udg_CSS_Hashtable, GetHandleId(u), bonusType) < 0 then
call UnitAddAbility(u, udg_CSS_Abilities[(bonusType + 1)*18 - 1])
call UnitMakeAbilityPermanent(u, true, udg_CSS_Abilities[(bonusType + 1)*18 - 1])
endif
else
call SaveInteger(udg_CSS_Hashtable, GetHandleId(u), bonusType, amount)
if amount < 0 then
set amount = max + amount
call UnitAddAbility(u, udg_CSS_Abilities[(bonusType + 1)*18 - 1])
call UnitMakeAbilityPermanent(u, true, udg_CSS_Abilities[(bonusType + 1)*18 - 1])
else
call UnitRemoveAbility(u, udg_CSS_Abilities[(bonusType+1)*18 - 1])
endif
loop
if amount >= udg_CSS_Power[i] then
call UnitAddAbility(u, udg_CSS_Abilities[bonusType*18 + i])
call UnitMakeAbilityPermanent(u, true, udg_CSS_Abilities[bonusType*18 + i])
set amount = amount - udg_CSS_Power[i]
else
call UnitRemoveAbility(u, udg_CSS_Abilities[bonusType*18 + i])
endif
set i = i - 1
exitwhen i < 0
endloop
endif
endfunction
Name | Type | is_array | initial_value |
CSS_Abilities | abilcode | Yes | |
CSS_Counter | integer | No | |
CSS_CustomSwitch | boolean | No | false |
CSS_EventMainItem | item | No | |
CSS_EventMainItemStacked | item | Yes | |
CSS_EventSocketItem | item | No | |
CSS_EventSocketItemStacked | item | Yes | |
CSS_EventUnit | unit | No | |
CSS_EventUnitStacked | unit | Yes | |
CSS_GemBonusBoolean | boolean | No | false |
CSS_GemLevel | integer | No | 100 |
CSS_Hashtable | hashtable | No | |
CSS_Power | integer | Yes | |
CSS_PreloadBoolean | boolean | No | true |
CSS_SocketingEnabled | boolean | No | true |
CSS_String | string | Yes | |
EVENT_SOCKET_FINISH | real | No |
//************************************************************************************************************
//* *
//* CUSTOM STAT SYSTEM (CSS) *
//* *
//* Author: Doomlord *
//* Version: 1.5g *
//* *
//* Credits: *
//* + Earth-Fury: BonusMod binary algoritm; implementation macro. *
//* + Crigges: A great amount of help and support. *
//* + Geries: Help me with the item hashtable values cleanup. *
//* + rulerofiron99: Item Socketing method referenced from [GUI]Right Click Item Recipe v1.05. *
//* + Vexorian: CSS_SimError [url]http://www.wc3c.net/showthread.php?t=101260[/url] *
//* + Magtheridon96: [Snippet]BoundInt [url]http://www.hiveworkshop.com/forums/2294066-post804.html[/url] *
//* + WaterKnight: Help with the stack for custom Event Response. *
//* + PurgeandFire: Pinpoint a possible desync bug with the system. *
//* + Nestharus: Mentioning the possible negative life bug in his Bonus lib. *
//* *
//************************************************************************************************************
//**************************************************************************************
//* INTRODUCTION: *
//* *
//* An alternative to BonusMod for those who prefer a vanilla JASS approach. *
//* *
//* Just follow the API and you are pretty much done. *
//**************************************************************************************
//********************************************************************************************************
//* REQUIREMENTS: *
//* *
//* JNGP [url]http://www.hiveworkshop.com/forums/tools-560/jassnewgenpack-5d-227445[/url] (Recommended) *
//* OR: *
//* Your superhuman capability to transfer 198 abilities to your map. (Not Recommended) *
//********************************************************************************************************
//************************************************************************************************************************************************
//* INSTALLATION INSTRUCTION: *
//* *
//* Step 1: Copy the custom code for bonus handling to your map header. *
//* Step 2: Use JNGP to implement the system's abilities through macro. Instruction is included in the Implementation Macro trigger. *
//* Step 3: Copy the whole CSS folder to your map. Don't forget to turn on "Automatically create unknown variables while pasting trigger data". *
//* Step 4: Except for this trigger, delete every other useless elements. *
//* Step 5: Use this BonusMod alternative however you want. *
//* *
//************************************************************************************************************************************************
//**************************************************************************************
//* Bonus Types Identifier: *
//* *
//* Armor Bonus: 0 *
//* Attack Speed Bonus: 1 *
//* Damage Bonus: 2 *
//* Agility Bonus: 3 *
//* Intelligence Bonus: 4 *
//* Strength Bonus: 5 *
//* Life Regen Bonus: 6 *
//* Mana Regen Bonus: 7 *
//* Life Bonus: 8 *
//* Mana Bonus: 9 *
//* Sight Range Bonus: 10 *
//**************************************************************************************
//********************************************************************************
//* Generic Bonus APIs *
//* *
//* CSS_GetBonus takes unit u, integer bonusType returns integer *
//* CSS_AddBonus takes unit u, integer amount, integer bonusType returns nothing *
//* CSS_ClearBonus takes unit u, integer bonusType *
//********************************************************************************
// Clear bonus
function CSS_ClearBonus takes unit u, integer bonusType returns nothing
if bonusType > 10 or bonusType < 0 or GetUnitTypeId (u) == 0 or IsUnitType (u, UNIT_TYPE_DEAD) then
return
endif
call CSS_AddBonus (u, -LoadInteger (udg_CSS_Hashtable, GetHandleId (u), bonusType), bonusType)
endfunction
// Get current bonus
function CSS_GetBonus takes unit u, integer bonusType returns integer
if bonusType > 10 or bonusType < 0 or GetUnitTypeId (u) == 0 or IsUnitType (u, UNIT_TYPE_DEAD) then
return 0
endif
return LoadInteger (udg_CSS_Hashtable, GetHandleId (u), bonusType)
endfunction
// For preloading abilities
function CSS_Preload takes nothing returns nothing
local integer i = 0
local unit u = CreateUnit(Player(15), 'hfoo', 0, 0, 0.00)
loop
exitwhen i > 197
call UnitAddAbility(u, udg_CSS_Abilities[i])
set i = i + 1
endloop
call RemoveUnit(u)
set u = null
endfunction
//===========================================================================
function InitTrig_CSS_Standalone_Bonus takes nothing returns nothing
local integer i = 0
local integer a = 1
set udg_CSS_Abilities[0] = 'ZxA0'
set udg_CSS_Abilities[1] = 'ZxA1'
set udg_CSS_Abilities[2] = 'ZxA2'
set udg_CSS_Abilities[3] = 'ZxA3'
set udg_CSS_Abilities[4] = 'ZxA4'
set udg_CSS_Abilities[5] = 'ZxA5'
set udg_CSS_Abilities[6] = 'ZxA6'
set udg_CSS_Abilities[7] = 'ZxA7'
set udg_CSS_Abilities[8] = 'ZxA8'
set udg_CSS_Abilities[9] = 'ZxA9'
set udg_CSS_Abilities[10] = 'ZxAa'
set udg_CSS_Abilities[11] = 'ZxAb'
set udg_CSS_Abilities[12] = 'ZxAc'
set udg_CSS_Abilities[13] = 'ZxAd'
set udg_CSS_Abilities[14] = 'ZxAe'
set udg_CSS_Abilities[15] = 'ZxAf'
set udg_CSS_Abilities[16] = 'ZxAg'
set udg_CSS_Abilities[17] = 'ZxAh'
set udg_CSS_Abilities[18] = 'ZxI0'
set udg_CSS_Abilities[19] = 'ZxI1'
set udg_CSS_Abilities[20] = 'ZxI2'
set udg_CSS_Abilities[21] = 'ZxI3'
set udg_CSS_Abilities[22] = 'ZxI4'
set udg_CSS_Abilities[23] = 'ZxI5'
set udg_CSS_Abilities[24] = 'ZxI6'
set udg_CSS_Abilities[25] = 'ZxI7'
set udg_CSS_Abilities[26] = 'ZxI8'
set udg_CSS_Abilities[27] = 'ZxI9'
set udg_CSS_Abilities[28] = 'ZxIa'
set udg_CSS_Abilities[29] = 'ZxIb'
set udg_CSS_Abilities[30] = 'ZxIc'
set udg_CSS_Abilities[31] = 'ZxId'
set udg_CSS_Abilities[32] = 'ZxIe'
set udg_CSS_Abilities[33] = 'ZxIf'
set udg_CSS_Abilities[34] = 'ZxIg'
set udg_CSS_Abilities[35] = 'ZxIh'
set udg_CSS_Abilities[36] = 'ZxB0'
set udg_CSS_Abilities[37] = 'ZxB1'
set udg_CSS_Abilities[38] = 'ZxB2'
set udg_CSS_Abilities[39] = 'ZxB3'
set udg_CSS_Abilities[40] = 'ZxB4'
set udg_CSS_Abilities[41] = 'ZxB5'
set udg_CSS_Abilities[42] = 'ZxB6'
set udg_CSS_Abilities[43] = 'ZxB7'
set udg_CSS_Abilities[44] = 'ZxB8'
set udg_CSS_Abilities[45] = 'ZxB9'
set udg_CSS_Abilities[46] = 'ZxBa'
set udg_CSS_Abilities[47] = 'ZxBb'
set udg_CSS_Abilities[48] = 'ZxBc'
set udg_CSS_Abilities[49] = 'ZxBd'
set udg_CSS_Abilities[50] = 'ZxBe'
set udg_CSS_Abilities[51] = 'ZxBf'
set udg_CSS_Abilities[52] = 'ZxBg'
set udg_CSS_Abilities[53] = 'ZxBh'
set udg_CSS_Abilities[54] = 'ZxG0'
set udg_CSS_Abilities[55] = 'ZxG1'
set udg_CSS_Abilities[56] = 'ZxG2'
set udg_CSS_Abilities[57] = 'ZxG3'
set udg_CSS_Abilities[58] = 'ZxG4'
set udg_CSS_Abilities[59] = 'ZxG5'
set udg_CSS_Abilities[60] = 'ZxG6'
set udg_CSS_Abilities[61] = 'ZxG7'
set udg_CSS_Abilities[62] = 'ZxG8'
set udg_CSS_Abilities[63] = 'ZxG9'
set udg_CSS_Abilities[64] = 'ZxGa'
set udg_CSS_Abilities[65] = 'ZxGb'
set udg_CSS_Abilities[66] = 'ZxGc'
set udg_CSS_Abilities[67] = 'ZxGd'
set udg_CSS_Abilities[68] = 'ZxGe'
set udg_CSS_Abilities[69] = 'ZxGf'
set udg_CSS_Abilities[70] = 'ZxGg'
set udg_CSS_Abilities[71] = 'ZxGh'
set udg_CSS_Abilities[72] = 'ZxH0'
set udg_CSS_Abilities[73] = 'ZxH1'
set udg_CSS_Abilities[74] = 'ZxH2'
set udg_CSS_Abilities[75] = 'ZxH3'
set udg_CSS_Abilities[76] = 'ZxH4'
set udg_CSS_Abilities[77] = 'ZxH5'
set udg_CSS_Abilities[78] = 'ZxH6'
set udg_CSS_Abilities[79] = 'ZxH7'
set udg_CSS_Abilities[80] = 'ZxH8'
set udg_CSS_Abilities[81] = 'ZxH9'
set udg_CSS_Abilities[82] = 'ZxHa'
set udg_CSS_Abilities[83] = 'ZxHb'
set udg_CSS_Abilities[84] = 'ZxHc'
set udg_CSS_Abilities[85] = 'ZxHd'
set udg_CSS_Abilities[86] = 'ZxHe'
set udg_CSS_Abilities[87] = 'ZxHf'
set udg_CSS_Abilities[88] = 'ZxHg'
set udg_CSS_Abilities[89] = 'ZxHh'
set udg_CSS_Abilities[90] = 'ZxF0'
set udg_CSS_Abilities[91] = 'ZxF1'
set udg_CSS_Abilities[92] = 'ZxF2'
set udg_CSS_Abilities[93] = 'ZxF3'
set udg_CSS_Abilities[94] = 'ZxF4'
set udg_CSS_Abilities[95] = 'ZxF5'
set udg_CSS_Abilities[96] = 'ZxF6'
set udg_CSS_Abilities[97] = 'ZxF7'
set udg_CSS_Abilities[98] = 'ZxF8'
set udg_CSS_Abilities[99] = 'ZxF9'
set udg_CSS_Abilities[100] = 'ZxFa'
set udg_CSS_Abilities[101] = 'ZxFb'
set udg_CSS_Abilities[102] = 'ZxFc'
set udg_CSS_Abilities[103] = 'ZxFd'
set udg_CSS_Abilities[104] = 'ZxFe'
set udg_CSS_Abilities[105] = 'ZxFf'
set udg_CSS_Abilities[106] = 'ZxFg'
set udg_CSS_Abilities[107] = 'ZxFh'
set udg_CSS_Abilities[108] = 'ZxJ0'
set udg_CSS_Abilities[109] = 'ZxJ1'
set udg_CSS_Abilities[110] = 'ZxJ2'
set udg_CSS_Abilities[111] = 'ZxJ3'
set udg_CSS_Abilities[112] = 'ZxJ4'
set udg_CSS_Abilities[113] = 'ZxJ5'
set udg_CSS_Abilities[114] = 'ZxJ6'
set udg_CSS_Abilities[115] = 'ZxJ7'
set udg_CSS_Abilities[116] = 'ZxJ8'
set udg_CSS_Abilities[117] = 'ZxJ9'
set udg_CSS_Abilities[118] = 'ZxJa'
set udg_CSS_Abilities[119] = 'ZxJb'
set udg_CSS_Abilities[120] = 'ZxJc'
set udg_CSS_Abilities[121] = 'ZxJd'
set udg_CSS_Abilities[122] = 'ZxJe'
set udg_CSS_Abilities[123] = 'ZxJf'
set udg_CSS_Abilities[124] = 'ZxJg'
set udg_CSS_Abilities[125] = 'ZxJh'
set udg_CSS_Abilities[126] = 'ZxK0'
set udg_CSS_Abilities[127] = 'ZxK1'
set udg_CSS_Abilities[128] = 'ZxK2'
set udg_CSS_Abilities[129] = 'ZxK3'
set udg_CSS_Abilities[130] = 'ZxK4'
set udg_CSS_Abilities[131] = 'ZxK5'
set udg_CSS_Abilities[132] = 'ZxK6'
set udg_CSS_Abilities[133] = 'ZxK7'
set udg_CSS_Abilities[134] = 'ZxK8'
set udg_CSS_Abilities[135] = 'ZxK9'
set udg_CSS_Abilities[136] = 'ZxKa'
set udg_CSS_Abilities[137] = 'ZxKb'
set udg_CSS_Abilities[138] = 'ZxKc'
set udg_CSS_Abilities[139] = 'ZxKd'
set udg_CSS_Abilities[140] = 'ZxKe'
set udg_CSS_Abilities[141] = 'ZxKf'
set udg_CSS_Abilities[142] = 'ZxKg'
set udg_CSS_Abilities[143] = 'ZxKh'
set udg_CSS_Abilities[144] = 'ZxE0'
set udg_CSS_Abilities[145] = 'ZxE1'
set udg_CSS_Abilities[146] = 'ZxE2'
set udg_CSS_Abilities[147] = 'ZxE3'
set udg_CSS_Abilities[148] = 'ZxE4'
set udg_CSS_Abilities[149] = 'ZxE5'
set udg_CSS_Abilities[150] = 'ZxE6'
set udg_CSS_Abilities[151] = 'ZxE7'
set udg_CSS_Abilities[152] = 'ZxE8'
set udg_CSS_Abilities[153] = 'ZxE9'
set udg_CSS_Abilities[154] = 'ZxEa'
set udg_CSS_Abilities[155] = 'ZxEb'
set udg_CSS_Abilities[156] = 'ZxEc'
set udg_CSS_Abilities[157] = 'ZxEd'
set udg_CSS_Abilities[158] = 'ZxEe'
set udg_CSS_Abilities[159] = 'ZxEf'
set udg_CSS_Abilities[160] = 'ZxEg'
set udg_CSS_Abilities[161] = 'ZxEh'
set udg_CSS_Abilities[162] = 'ZxD0'
set udg_CSS_Abilities[163] = 'ZxD1'
set udg_CSS_Abilities[164] = 'ZxD2'
set udg_CSS_Abilities[165] = 'ZxD3'
set udg_CSS_Abilities[166] = 'ZxD4'
set udg_CSS_Abilities[167] = 'ZxD5'
set udg_CSS_Abilities[168] = 'ZxD6'
set udg_CSS_Abilities[169] = 'ZxD7'
set udg_CSS_Abilities[170] = 'ZxD8'
set udg_CSS_Abilities[171] = 'ZxD9'
set udg_CSS_Abilities[172] = 'ZxDa'
set udg_CSS_Abilities[173] = 'ZxDb'
set udg_CSS_Abilities[174] = 'ZxDc'
set udg_CSS_Abilities[175] = 'ZxDd'
set udg_CSS_Abilities[176] = 'ZxDe'
set udg_CSS_Abilities[177] = 'ZxDf'
set udg_CSS_Abilities[178] = 'ZxDg'
set udg_CSS_Abilities[179] = 'ZxDh'
set udg_CSS_Abilities[180] = 'ZxC0'
set udg_CSS_Abilities[181] = 'ZxC1'
set udg_CSS_Abilities[182] = 'ZxC2'
set udg_CSS_Abilities[183] = 'ZxC3'
set udg_CSS_Abilities[184] = 'ZxC4'
set udg_CSS_Abilities[185] = 'ZxC5'
set udg_CSS_Abilities[186] = 'ZxC6'
set udg_CSS_Abilities[187] = 'ZxC7'
set udg_CSS_Abilities[188] = 'ZxC8'
set udg_CSS_Abilities[189] = 'ZxC9'
set udg_CSS_Abilities[190] = 'ZxCa'
set udg_CSS_Abilities[191] = 'ZxCb'
set udg_CSS_Abilities[192] = 'ZxCc'
set udg_CSS_Abilities[193] = 'ZxCd'
set udg_CSS_Abilities[194] = 'ZxCe'
set udg_CSS_Abilities[195] = 'ZxCf'
set udg_CSS_Abilities[196] = 'ZxCg'
set udg_CSS_Abilities[197] = 'ZxCh'
loop
exitwhen i > 30
set udg_CSS_Power[i] = a
set a = a*2
set i = i + 1
endloop
set udg_CSS_Hashtable = InitHashtable()
if udg_CSS_PreloadBoolean then
call CSS_Preload()
endif
endfunction
//************************************************************************************************************
//* *
//* CUSTOM STAT SYSTEM (CSS) *
//* *
//* Author: Doomlord *
//* Version: 1.5g *
//* *
//* Credits: *
//* + Earth-Fury: BonusMod binary algoritm; implementation macro. *
//* + Crigges: A great amount of help and support. *
//* + Geries: Help me with the item hashtable values cleanup. *
//* + rulerofiron99: Item Socketing method referenced from [GUI]Right Click Item Recipe v1.05. *
//* + Vexorian: CSS_SimError [url]http://www.wc3c.net/showthread.php?t=101260[/url] *
//* + Magtheridon96: [Snippet]BoundInt [url]http://www.hiveworkshop.com/forums/2294066-post804.html[/url] *
//* + WaterKnight: Help with the stack for custom Event Response. *
//* + PurgeandFire: Pinpoint a possible desync bug with the system. *
//* + Nestharus: Mentioning the possible negative life bug in his Bonus lib. *
//* *
//************************************************************************************************************
//**************************************************************************************
//* INTRODUCTION: *
//* *
//* 1 item - 11 passive stats with one custom script. This is Custom Stat System (CSS) *
//* *
//* A system that aims to get rid of mapmakers' annoyance of having to do a boring and *
//* repetitive job of creating a multitude of item passive stat abilities. At the *
//* same time it also possesses generic bonus mod features to let you modify a unit's *
//* stats freely and easily. It is also quite GUI friendly since everything can be *
//* achieved solely through custom scripts. *
//* *
//* Version 1.2 and onwards supports item socketing. *
//**************************************************************************************
//**********************************************************************************************************************************
//* FEATURES: *
//* *
//* Pros: *
//* + Simple and GUI-friendly item passive stats registration. *
//* + Has little effect on performance. *
//* + Quick implementation of system and system abilities through macro. *
//* + You no longer have to sit for hours creating item passive abilities for your map. *
//* + Use only 1 hashtable (udg_CSS_Hashtable). *
//* + Pure JASS, only require JNGP for ability implementation. *
//* + BonusMod-like features with better range for some stats. *
//* + Bonus Range: -131072 to 131071. *
//* + Right Click Item Socketing. *
//* + Socket event can be caught with the Event: EVENT_SOCKET_FINISH becomes equal to 1.00. *
//* + In JASS: call TriggerRegisterVariableEvent(trigger, "EVENT_SOCKET_FINISH", EQUAL, 1.00). * *
//* *
//* Cons: *
//* + Does not include movement speed. *
//* + May bug if a unit somehow surpasses the bonus limit in some occasion. *
//* -> Fix: Don't allow a unit to achieve near-limit for a stat i.e keep it at a reasonable level. *
//* + Limited configurability. *
//* + Insufficient item tooltip, which is unavoidable because it is hard-coded. *
//**********************************************************************************************************************************
//********************************************************************************************************
//* REQUIREMENTS: *
//* *
//* JNGP [url]http://www.hiveworkshop.com/forums/tools-560/jassnewgenpack-5d-227445[/url] (Recommended) *
//* OR: *
//* Your superhuman capability to transfer 198 abilities to your map. (Not Recommended) *
//********************************************************************************************************
//************************************************************************************************************************************************
//* INSTALLATION INSTRUCTION: *
//* *
//* Step 1: Copy the custom code for bonus handling to your map header. *
//* Step 2: Use JNGP to implement the system's abilities through macro. Instruction is included in the Implementation Macro trigger. *
//* Step 3: Copy the whole CSS folder to your map. Don't forget to turn on "Automatically create unknown variables while pasting trigger data". *
//* Step 4: Put the CSS trigger on top of your Item Declaration trigger. *
//* Step 5: Register your items as examplified in the Item Declaration trigger. Remember to use Map Initialization event. *
//* Step 6: Set the global variables to modify your settings. *
//* + udg_CSS_GemLevel: set a level identifier for your gem items. Gem Items must have a level higher than this value to function, *
//* + udg_CSS_Preload: set to true if you want to preload system abilities. Increase loading time but prevents first lags. *
//* + udg_CSS_SocketingEnabled: set to true if you want to enable the Right Click Item Socketing feature. *
//* + udg_CSS_GemBonusBoolean: set to true if you want to allow wielded gems to display its bonuses. *
//* + udg_CSS_CustomSwitch: set to true if you want the item to give bonus only when it is fully socketed. *
//************************************************************************************************************************************************
//**************************************************************************************
//* Item Registration API *
//* *
//* call CSS_ItemInitialize (integer itemRawCode, integer armorBonus, *
//* integer attackSpeedBonus, integer damageBonus, integer agilityBonus, *
//* integer intelligenceBonus, integer strengthBonus, integer lifeRegenBonus, *
//* integer manaRegenBonus, integer lifeBonus, integer manaBonus, *
//* integer sightRangeBonus, integer socket) *
//**************************************************************************************
//**************************************************************************************
//* Gem Registration API *
//* *
//* call CSS_GemInitialize (integer itemRawCode, integer armorBonus, *
//* integer attackSpeedBonus, integer damageBonus, integer agilityBonus, *
//* integer intelligenceBonus, integer strengthBonus, integer lifeRegenBonus, *
//* integer manaRegenBonus, integer lifeBonus, integer manaBonus, *
//* integer sightRangeBonus) *
//**************************************************************************************
//===========================================================================
// Only needed if you decided to use Right Click Item Socketing
// Item socket effect
constant function CSS_ItemSocketEffect takes nothing returns string
return "Abilities\\Spells\\Items\\AIlm\\AIlmTarget.mdl"
endfunction
// Item socket effect attachment point
constant function CSS_ISEAttachPoint takes nothing returns string
return "origin"
endfunction
// Item preload
function CSS_ItemPreload takes nothing returns nothing
local unit u = CreateUnit(Player(15), 'Hpal', 0, 0, 0.00)
local integer i = 0
local integer j = LoadInteger (udg_CSS_Hashtable, -5, -5)
local item array it
loop
exitwhen i > j
set it[i] = CreateItem (LoadInteger (udg_CSS_Hashtable, -5, i), 0, 0)
call UnitAddItem (u, it[i])
set i = i + 1
endloop
set i = 0
loop
exitwhen i > j
call RemoveItem (it[i])
set it[i] = null
set i = i + 1
endloop
call RemoveUnit (u)
call FlushChildHashtable (udg_CSS_Hashtable, -5)
set u = null
endfunction
//===========================================================================
// Fail-safe mechanism, only use in specific cases to avoid possible collision with other systems
// Refresh and update the unit's stats given by items in its inventory
// In a nutshell, do not use this unless you know what you are doing
function CSS_StatUpdate takes unit u returns nothing
local integer i = 0
local integer j = 0
local integer k = GetHandleId (u)
loop
exitwhen j > 10
call CSS_AddBonus (u, -LoadInteger (udg_CSS_Hashtable, k, j - 11), j)
call SaveInteger (udg_CSS_Hashtable, k, j - 11, 0)
set j = j + 1
endloop
loop
exitwhen i > 5
set j = 0
loop
exitwhen j > 10
call CSS_AddBonus (u, LoadInteger (udg_CSS_Hashtable, GetHandleId (UnitItemInSlot (u, i)), j), j)
call SaveInteger (udg_CSS_Hashtable, k, j - 11, LoadInteger (udg_CSS_Hashtable, k, j - 11) + LoadInteger (udg_CSS_Hashtable, GetHandleId (UnitItemInSlot (u, i)), j))
set j = j + 1
endloop
set i = i + 1
endloop
endfunction
// Item Socket Info Panel
function CSS_ItemInfoSocketPanel takes nothing returns boolean
local group g = CreateGroup ()
local item it
local unit u
local integer i
local integer j = 0
local player p = GetTriggerPlayer ()
local integer k
local string s
if not udg_CSS_SocketingEnabled then
call CSS_SimError ("Socketing feature is not enabled")
call DestroyGroup (g)
set p = null
set g = null
return false
endif
call GroupEnumUnitsSelected(g, p, null)
if CountUnitsInGroup (g) > 1 then
call CSS_SimError ("Invalid Selection")
call DestroyGroup (g)
set p = null
set g = null
return false
else
set u = FirstOfGroup (g)
if not IsUnitOwnedByPlayer (u, p) then
call CSS_SimError ("You must select an owned unit")
else
set it = UnitItemInSlot (u, S2I(SubString(GetEventPlayerChatString(), 16, StringLength(GetEventPlayerChatString()))) - 1)
if it == null or not LoadBoolean (udg_CSS_Hashtable, GetItemTypeId (it), -4) then
call CSS_SimError ("No item in chosen slot or chosen item is not registered with CSS")
else
call DisplayTimedTextToPlayer (p, 0, 0, 15, udg_CSS_String[25] + "Item Name: " + "|r" + udg_CSS_String[12] + GetItemName (it) + "|r")
call DisplayTimedTextToPlayer (p, 0, 0, 15, "\n")
set i = GetHandleId (it)
set k = GetItemTypeId (it)
loop
exitwhen j == LoadInteger (udg_CSS_Hashtable, k, -2)
set s = LoadStr (udg_CSS_Hashtable, i, -31 - j)
if s == null then
set s = "Not Socketed"
endif
call DisplayTimedTextToPlayer (p, 0, 0, 15, udg_CSS_String[25] + "Socket " + "#" + I2S (j + 1) + ": " + "|r" + udg_CSS_String[11] + s + "|r")
set s = ""
set j = j + 1
endloop
endif
set it = null
endif
set u = null
endif
call DestroyGroup (g)
set g = null
set p = null
return false
endfunction
// Item Info Panel
function CSS_ItemInfoPanel takes nothing returns boolean
local group g = CreateGroup ()
local item it
local unit u
local integer i
local integer j = 0
local player p = GetTriggerPlayer ()
local integer k
local integer l
local string s1
local string s2
call GroupEnumUnitsSelected(g, p, null)
if CountUnitsInGroup (g) > 1 then
call CSS_SimError ("Invalid Selection")
call DestroyGroup (g)
set p = null
set g = null
return false
else
set u = FirstOfGroup (g)
if not IsUnitOwnedByPlayer (u, p) then
call CSS_SimError ("You must select an owned unit")
else
set it = UnitItemInSlot (u, S2I(SubString(GetEventPlayerChatString(), 10, StringLength(GetEventPlayerChatString()))) - 1)
if it == null or not LoadBoolean (udg_CSS_Hashtable, GetItemTypeId (it), -4) then
call CSS_SimError ("No item in chosen slot or chosen item is not registered with CSS")
else
set i = GetHandleId (it)
set k = GetItemTypeId (it)
if udg_CSS_SocketingEnabled then
call DisplayTimedTextToPlayer (p, 0, 0, 15, udg_CSS_String[25] + "Item Name: " + "|r" + udg_CSS_String[12] + GetItemName (it) + "|r")
call DisplayTimedTextToPlayer (p, 0, 0, 15, "\n")
else
call DisplayTimedTextToPlayer (p, 0, 0, 15, "\n\n\n" + udg_CSS_String[25] + "Item Name: " + "|r" + udg_CSS_String[12] + GetItemName (it) + "|r")
call DisplayTimedTextToPlayer (p, 0, 0, 15, "\n")
endif
loop
exitwhen j > 10
if udg_CSS_SocketingEnabled then
set l = LoadInteger (udg_CSS_Hashtable, i, j)
if l > 0 then
set s2 = "+"
else
set s2 = ""
endif
if l - LoadInteger (udg_CSS_Hashtable, k, j) > 0 then
set s1 = udg_CSS_String[24] + " +" + I2S (l - LoadInteger (udg_CSS_Hashtable, k, j)) + "|r"
elseif l - LoadInteger (udg_CSS_Hashtable, k, j) < 0 then
set s1 = udg_CSS_String[24] + " -" + I2S (LoadInteger (udg_CSS_Hashtable, k, j) - l) + "|r"
else
set s1 = ""
endif
if j == 1 or j == 7 and s1 != "" then
set s1 = s1 + udg_CSS_String[24] + "%|r"
endif
if j == 1 or j == 7 then
call DisplayTimedTextToPlayer (p, 0, 0, 15, udg_CSS_String[25] + udg_CSS_String[j] + "|r" + udg_CSS_String[13+j] + s2 + I2S (LoadInteger (udg_CSS_Hashtable, k, j)) + "%|r" + s1)
else
call DisplayTimedTextToPlayer (p, 0, 0, 15, udg_CSS_String[25] + udg_CSS_String[j] + "|r" + udg_CSS_String[13+j] + s2 + I2S (LoadInteger (udg_CSS_Hashtable, k, j)) + "|r" + s1)
endif
set s1 = ""
set s2 = ""
else
set l = LoadInteger (udg_CSS_Hashtable, k, j)
if l > 0 then
set s2 = "+"
else
set s2 = ""
endif
if j == 1 or j == 7 then
call DisplayTimedTextToPlayer (p, 0, 0, 15, udg_CSS_String[25] + udg_CSS_String[j] + "|r" + udg_CSS_String[13+j] + s2 + I2S (LoadInteger (udg_CSS_Hashtable, k, j)) + "%|r")
else
call DisplayTimedTextToPlayer (p, 0, 0, 15, udg_CSS_String[25] + udg_CSS_String[j] + "|r" + udg_CSS_String[13+j] + s2 + I2S (LoadInteger (udg_CSS_Hashtable, k, j)) + "|r")
endif
set s2 = ""
endif
set j = j + 1
endloop
if udg_CSS_SocketingEnabled then
call DisplayTimedTextToPlayer (p, 0, 0, 15, udg_CSS_String[25] + "\nNumber of sockets: " + "|r" + udg_CSS_String[26] + I2S (LoadInteger (udg_CSS_Hashtable, k, -2)) + "|r")
if not HaveSavedInteger (udg_CSS_Hashtable, i, -2) then
call DisplayTimedTextToPlayer (p, 0, 0, 15, udg_CSS_String[25] + "Number of empty sockets: " + "|r" + udg_CSS_String[26] + I2S (LoadInteger (udg_CSS_Hashtable, k, -2)) + "|r")
else
call DisplayTimedTextToPlayer (p, 0, 0, 15, udg_CSS_String[25] + "Number of empty sockets: " + "|r" + udg_CSS_String[26] + I2S (LoadInteger (udg_CSS_Hashtable, i, -2)) + "|r")
endif
endif
endif
set it = null
endif
set u = null
endif
call DestroyGroup (g)
set g = null
set p = null
return false
endfunction
// Item sell event check
function CSS_ItemPawnCheck takes nothing returns boolean
local unit u = GetTriggerUnit ()
local integer i = GetHandleId (GetSoldItem ())
local integer k = GetItemTypeId (GetSoldItem ())
local trigger trig
local integer t
local integer j = 0
local integer m = GetHandleId (u)
loop
exitwhen j > 10
if udg_CSS_SocketingEnabled then
call CSS_AddBonus(u, -LoadInteger (udg_CSS_Hashtable, i, j), j)
call SaveInteger (udg_CSS_Hashtable, m, j - 11, LoadInteger (udg_CSS_Hashtable, m, j - 11) - LoadInteger (udg_CSS_Hashtable, i, j))
else
call CSS_AddBonus(u, -LoadInteger (udg_CSS_Hashtable, k, j), j)
call SaveInteger (udg_CSS_Hashtable, m, j - 11, LoadInteger (udg_CSS_Hashtable, m, j - 11) - LoadInteger (udg_CSS_Hashtable, k, j))
endif
set j = j + 1
endloop
if LoadBoolean (udg_CSS_Hashtable, i, -6) then
set trig = LoadTriggerHandle (udg_CSS_Hashtable, i, -10)
set t = GetHandleId (trig)
call SaveInteger (udg_CSS_Hashtable, t, 1, LoadInteger (udg_CSS_Hashtable, t, 1) + 1)
if LoadInteger (udg_CSS_Hashtable, t, 1) == LoadInteger (udg_CSS_Hashtable, t, 0) then
call DestroyTrigger (trig)
call FlushChildHashtable (udg_CSS_Hashtable, t)
if LoadTriggerHandle (udg_CSS_Hashtable, -10, -1) == trig then
call RemoveSavedHandle (udg_CSS_Hashtable, -10, -1)
endif
endif
set trig = null
call FlushChildHashtable (udg_CSS_Hashtable, i)
endif
set u = null
return false
endfunction
// Only needed if you decided to use Right Click Item Socketing
// Item socket event check
function CSS_ItemSocketCheck takes nothing returns boolean
local item itemMain
local item itemSocket
local integer itemSlot
local unit u
local integer j = 0
local integer i
local integer k
local integer l
local integer m
local integer n
if GetOrderTargetItem() != null then
set u = GetTriggerUnit()
set itemSlot = GetIssuedOrderId() - 852002
set itemMain = UnitItemInSlot (u, itemSlot)
set itemSocket = GetOrderTargetItem()
set i = GetItemTypeId (itemSocket)
set k = GetItemTypeId (itemMain)
set l = GetHandleId (itemMain)
set m = GetHandleId (itemSocket)
if not HaveSavedInteger (udg_CSS_Hashtable, l, -2) then
call SaveInteger (udg_CSS_Hashtable, l, -2, LoadInteger (udg_CSS_Hashtable, k, -2))
endif
set n = LoadInteger (udg_CSS_Hashtable, l, -2)
if itemMain != null and itemSocket != null and itemMain != itemSocket then
if (LoadBoolean (udg_CSS_Hashtable, i, -3) and LoadBoolean (udg_CSS_Hashtable, k, -3)) or (not LoadBoolean (udg_CSS_Hashtable, i, -4) and LoadBoolean (udg_CSS_Hashtable, k, -3)) or (not LoadBoolean (udg_CSS_Hashtable, k, -4) and LoadBoolean (udg_CSS_Hashtable, i, -3)) or (not LoadBoolean (udg_CSS_Hashtable, i, -4) and not LoadBoolean (udg_CSS_Hashtable, k, -3)) or (not LoadBoolean (udg_CSS_Hashtable, k, -4) and not LoadBoolean (udg_CSS_Hashtable, i, -3)) or (LoadBoolean (udg_CSS_Hashtable, k, -7) and LoadBoolean (udg_CSS_Hashtable, i, -7)) then
set itemSocket = null
set itemMain = null
set u = null
return false
endif
if GetItemLevel (itemSocket) > udg_CSS_GemLevel and GetItemLevel (itemMain) < udg_CSS_GemLevel and n > 0 then
loop
exitwhen j > 10
call SaveInteger (udg_CSS_Hashtable, l, j, LoadInteger (udg_CSS_Hashtable, l, j) + LoadInteger (udg_CSS_Hashtable, i, j))
if not udg_CSS_GemBonusBoolean and not udg_CSS_CustomSwitch then
call CSS_AddBonus(u, LoadInteger (udg_CSS_Hashtable, i, j), j)
endif
call SaveInteger (udg_CSS_Hashtable, GetHandleId (u), j - 11, LoadInteger (udg_CSS_Hashtable, GetHandleId (u), j - 11) + LoadInteger (udg_CSS_Hashtable, i, j))
set j = j + 1
endloop
call SaveStr (udg_CSS_Hashtable, l, -30 - LoadInteger (udg_CSS_Hashtable, k, -2) + n - 1, GetItemName(itemSocket))
call CSS_SimNotification (GetItemName(itemMain) + " has been socketed with " + GetItemName(itemSocket) + " - " + I2S(n - 1) + " sockets left")
call SaveBoolean (udg_CSS_Hashtable, m, -1, true)
call SaveBoolean (udg_CSS_Hashtable, m, -1, false)
call DestroyEffect (AddSpecialEffectTarget (CSS_ItemSocketEffect(), u, CSS_ISEAttachPoint ()))
call SaveInteger (udg_CSS_Hashtable, l, -2, n - 1)
set j = 0
if udg_CSS_CustomSwitch and LoadInteger (udg_CSS_Hashtable, l, -2) == 0 then
loop
exitwhen j > 10
call CSS_AddBonus(u, LoadInteger (udg_CSS_Hashtable, l, j), j)
set j = j + 1
endloop
endif
set udg_CSS_Counter = udg_CSS_Counter + 1
set udg_CSS_EventMainItemStacked[udg_CSS_Counter] = itemMain
set udg_CSS_EventSocketItemStacked[udg_CSS_Counter] = itemSocket
set udg_CSS_EventUnitStacked[udg_CSS_Counter] = u
set udg_CSS_EventMainItem = itemMain
set udg_CSS_EventSocketItem = itemSocket
set udg_CSS_EventUnit = u
set udg_EVENT_SOCKET_FINISH = 1
set udg_EVENT_SOCKET_FINISH = 0
set udg_CSS_EventMainItem = null
set udg_CSS_EventSocketItem = null
set udg_CSS_EventUnit = null
set udg_CSS_EventMainItemStacked[udg_CSS_Counter] = null
set udg_CSS_EventSocketItemStacked[udg_CSS_Counter] = null
set udg_CSS_EventUnitStacked[udg_CSS_Counter] = null
set udg_CSS_Counter = udg_CSS_Counter - 1
call RemoveItem (itemSocket)
elseif LoadInteger (udg_CSS_Hashtable, l, -2) == 0 and LoadBoolean (udg_CSS_Hashtable, k, -3) then
call CSS_SimError ("Main item is fully socketed")
endif
endif
set u = null
set itemMain = null
set itemSocket = null
endif
return false
endfunction
// Item drop event check
function CSS_ItemDropCheck takes nothing returns boolean
local unit u = GetTriggerUnit()
local integer i = GetHandleId (GetManipulatedItem())
local integer k = GetItemTypeId (GetManipulatedItem())
local integer j = 0
local integer m = GetHandleId (u)
if not LoadBoolean (udg_CSS_Hashtable, i, -1) then
if not LoadBoolean (udg_CSS_Hashtable, k, -3) and LoadBoolean (udg_CSS_Hashtable, k, -5) then
set u = null
return false
endif
if udg_CSS_CustomSwitch and (not HaveSavedInteger (udg_CSS_Hashtable, i, -2) or LoadInteger (udg_CSS_Hashtable, i, -2) != 0) then
set u = null
return false
endif
loop
exitwhen j > 10
if udg_CSS_SocketingEnabled then
call CSS_AddBonus(u, -LoadInteger (udg_CSS_Hashtable, i, j), j)
call SaveInteger (udg_CSS_Hashtable, m, j - 11, LoadInteger (udg_CSS_Hashtable, m, j - 11) - LoadInteger (udg_CSS_Hashtable, i, j))
else
call CSS_AddBonus(u, -LoadInteger (udg_CSS_Hashtable, k, j), j)
call SaveInteger (udg_CSS_Hashtable, m, j - 11, LoadInteger (udg_CSS_Hashtable, m, j - 11) - LoadInteger (udg_CSS_Hashtable, k, j))
endif
set j = j + 1
endloop
endif
set u = null
return false
endfunction
// Only needed if you decided to use Right Click Item Socketing
// Function for clearing dead/removed items' hashtable
function CSS_Event_Fire takes nothing returns boolean
local trigger trig = GetTriggeringTrigger ()
local integer t = GetHandleId (trig)
call SaveInteger (udg_CSS_Hashtable, t, 1, LoadInteger (udg_CSS_Hashtable, t, 1) + 1)
if LoadInteger (udg_CSS_Hashtable, t, 1) == LoadInteger (udg_CSS_Hashtable, t, 0) then
call DestroyTrigger (trig)
call FlushChildHashtable (udg_CSS_Hashtable, t)
if LoadTriggerHandle (udg_CSS_Hashtable, -10, -1) == trig then
call RemoveSavedHandle (udg_CSS_Hashtable, -10, -1)
endif
endif
call FlushChildHashtable (udg_CSS_Hashtable, GetHandleId (GetTriggerWidget()))
set trig = null
return false
endfunction
// Item acquisition event check
function CSS_ItemAcquireCheck takes nothing returns boolean
local trigger t = LoadTriggerHandle(udg_CSS_Hashtable, -10, -1)
local integer l = GetHandleId (t)
local unit u = GetTriggerUnit()
local integer i = GetItemTypeId(GetManipulatedItem())
local integer k = GetHandleId(GetManipulatedItem())
local integer j = 0
if not LoadBoolean (udg_CSS_Hashtable, k, -6) and LoadBoolean (udg_CSS_Hashtable, i, -4) and udg_CSS_SocketingEnabled then
if t == null or LoadInteger (udg_CSS_Hashtable, l, 0) == 100 then
set t = CreateTrigger ()
set l = GetHandleId (t)
call SaveInteger (udg_CSS_Hashtable, l, 0, 1)
call SaveInteger (udg_CSS_Hashtable, l, 1, 0)
call SaveTriggerHandle (udg_CSS_Hashtable, -10, -1, t)
call TriggerAddCondition (t, Condition(function CSS_Event_Fire))
else
call SaveInteger (udg_CSS_Hashtable, l, 0, LoadInteger (udg_CSS_Hashtable, l, 0) + 1)
endif
call SaveTriggerHandle (udg_CSS_Hashtable, k, -10, t)
call TriggerRegisterDeathEvent (t, GetManipulatedItem())
call SaveBoolean (udg_CSS_Hashtable, k, -6, true)
endif
if not LoadBoolean (udg_CSS_Hashtable, i, -5) then
loop
exitwhen j > 10
if not HaveSavedInteger (udg_CSS_Hashtable, k, j) then
call SaveInteger (udg_CSS_Hashtable, k, j, LoadInteger (udg_CSS_Hashtable, i, j))
endif
set j = j + 1
endloop
if udg_CSS_CustomSwitch and (not HaveSavedInteger (udg_CSS_Hashtable, k, -2) or LoadInteger (udg_CSS_Hashtable, k, -2) != 0) then
set t = null
set u = null
return false
endif
set j = 0
loop
exitwhen j > 10
if udg_CSS_SocketingEnabled then
call CSS_AddBonus(u, LoadInteger (udg_CSS_Hashtable, k, j), j)
call SaveInteger (udg_CSS_Hashtable, GetHandleId (u), j - 11, LoadInteger (udg_CSS_Hashtable, GetHandleId (u), j - 11) + LoadInteger (udg_CSS_Hashtable, k, j))
else
call CSS_AddBonus(u, LoadInteger (udg_CSS_Hashtable, i, j), j)
call SaveInteger (udg_CSS_Hashtable, GetHandleId (u), j - 11, LoadInteger (udg_CSS_Hashtable, GetHandleId (u), j - 11) + LoadInteger (udg_CSS_Hashtable, i, j))
endif
set j = j + 1
endloop
endif
set t = null
set u = null
return false
endfunction
// Item Database Initialize
function CSS_ItemInitialize takes integer itemRawCode, integer armorBonus, integer attackSpeedBonus, integer damageBonus, integer agilityBonus, integer intelligenceBonus, integer strengthBonus, integer lifeRegenBonus, integer manaRegenBonus, integer lifeBonus, integer manaBonus, integer sightRangeBonus, integer socket returns nothing
local integer j = LoadInteger (udg_CSS_Hashtable, -5, -5)
call SaveInteger (udg_CSS_Hashtable, -5, j, itemRawCode)
call SaveInteger (udg_CSS_Hashtable, -5, -5, j + 1)
call SaveInteger (udg_CSS_Hashtable, itemRawCode, 0, armorBonus)
call SaveInteger (udg_CSS_Hashtable, itemRawCode, 1, attackSpeedBonus)
call SaveInteger (udg_CSS_Hashtable, itemRawCode, 2, damageBonus)
call SaveInteger (udg_CSS_Hashtable, itemRawCode, 3, agilityBonus)
call SaveInteger (udg_CSS_Hashtable, itemRawCode, 4, intelligenceBonus)
call SaveInteger (udg_CSS_Hashtable, itemRawCode, 5, strengthBonus)
call SaveInteger (udg_CSS_Hashtable, itemRawCode, 6, lifeRegenBonus)
call SaveInteger (udg_CSS_Hashtable, itemRawCode, 7, manaRegenBonus)
call SaveInteger (udg_CSS_Hashtable, itemRawCode, 8, lifeBonus)
call SaveInteger (udg_CSS_Hashtable, itemRawCode, 9, manaBonus)
call SaveInteger (udg_CSS_Hashtable, itemRawCode, 10, sightRangeBonus)
call SaveBoolean (udg_CSS_Hashtable, itemRawCode, -4, true)
if udg_CSS_SocketingEnabled then
call SaveInteger (udg_CSS_Hashtable, itemRawCode, -2, socket)
call SaveBoolean (udg_CSS_Hashtable, itemRawCode, -3, true)
endif
endfunction
// Gem Database Initialize
function CSS_GemInitialize takes integer itemRawCode, integer armorBonus, integer attackSpeedBonus, integer damageBonus, integer agilityBonus, integer intelligenceBonus, integer strengthBonus, integer lifeRegenBonus, integer manaRegenBonus, integer lifeBonus, integer manaBonus, integer sightRangeBonus returns nothing
local integer j = LoadInteger (udg_CSS_Hashtable, -5, -5)
call SaveInteger (udg_CSS_Hashtable, -5, j, itemRawCode)
call SaveInteger (udg_CSS_Hashtable, -5, -5, j + 1)
call SaveInteger (udg_CSS_Hashtable, itemRawCode, 0, armorBonus)
call SaveInteger (udg_CSS_Hashtable, itemRawCode, 1, attackSpeedBonus)
call SaveInteger (udg_CSS_Hashtable, itemRawCode, 2, damageBonus)
call SaveInteger (udg_CSS_Hashtable, itemRawCode, 3, agilityBonus)
call SaveInteger (udg_CSS_Hashtable, itemRawCode, 4, intelligenceBonus)
call SaveInteger (udg_CSS_Hashtable, itemRawCode, 5, strengthBonus)
call SaveInteger (udg_CSS_Hashtable, itemRawCode, 6, lifeRegenBonus)
call SaveInteger (udg_CSS_Hashtable, itemRawCode, 7, manaRegenBonus)
call SaveInteger (udg_CSS_Hashtable, itemRawCode, 8, lifeBonus)
call SaveInteger (udg_CSS_Hashtable, itemRawCode, 9, manaBonus)
call SaveInteger (udg_CSS_Hashtable, itemRawCode, 10, sightRangeBonus)
call SaveBoolean (udg_CSS_Hashtable, itemRawCode, -4, true)
if udg_CSS_SocketingEnabled then
call SaveBoolean (udg_CSS_Hashtable, itemRawCode, -7, true)
if not udg_CSS_GemBonusBoolean then
call SaveBoolean (udg_CSS_Hashtable, itemRawCode, -5, true)
endif
endif
endfunction
//===========================================================================
function InitTrig_CSS_Item_Functions takes nothing returns nothing
local trigger acquireItem = CreateTrigger()
local trigger dropItem = CreateTrigger()
local trigger itemInfo = CreateTrigger()
local trigger itemSocketInfo = CreateTrigger()
local trigger socketItem
local trigger pawnItem
local integer j = 0
call SaveInteger (udg_CSS_Hashtable, -5, -5, 0)
call TriggerRegisterAnyUnitEventBJ(acquireItem, EVENT_PLAYER_UNIT_PICKUP_ITEM)
call TriggerAddCondition(acquireItem, Condition(function CSS_ItemAcquireCheck))
call TriggerRegisterAnyUnitEventBJ(dropItem, EVENT_PLAYER_UNIT_DROP_ITEM)
call TriggerAddCondition(dropItem, Condition(function CSS_ItemDropCheck))
set udg_CSS_String[0] = "Armor Bonus: "
set udg_CSS_String[1] = "Attack Speed Bonus: "
set udg_CSS_String[2] = "Damage Bonus: "
set udg_CSS_String[3] = "Agility Bonus: "
set udg_CSS_String[4] = "Intelligence Bonus: "
set udg_CSS_String[5] = "Strength Bonus: "
set udg_CSS_String[6] = "Life Regen Bonus: "
set udg_CSS_String[7] = "Mana Regen Bonus: "
set udg_CSS_String[8] = "Life Bonus: "
set udg_CSS_String[9] = "Mana Bonus: "
set udg_CSS_String[10] = "Sight Range Bonus: "
loop
call TriggerRegisterPlayerChatEvent(itemInfo, Player(j), "-iteminfo", false)
call TriggerRegisterPlayerChatEvent(itemSocketInfo, Player(j), "-itemsocketinfo", false)
set j = j + 1
exitwhen j > 15
endloop
call TriggerAddCondition(itemInfo, Condition(function CSS_ItemInfoPanel))
call TriggerAddCondition(itemSocketInfo, Condition(function CSS_ItemInfoSocketPanel))
if udg_CSS_SocketingEnabled then
set socketItem = CreateTrigger ()
set pawnItem = CreateTrigger ()
call TriggerRegisterAnyUnitEventBJ(socketItem, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER)
call TriggerAddCondition(socketItem, Condition(function CSS_ItemSocketCheck))
call TriggerRegisterAnyUnitEventBJ(pawnItem, EVENT_PLAYER_UNIT_PAWN_ITEM)
call TriggerAddCondition(pawnItem, Condition(function CSS_ItemPawnCheck))
set socketItem = null
set pawnItem = null
endif
set itemInfo = null
set itemSocketInfo = null
set acquireItem = null
set dropItem = null
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
// CSS Implementation Macro based on BonusMod's Implementation Macro
// Full credit goes to Earth-Fury
// The text below is extracted from BonusMod's
// About these macros:
//
// The first parameter is the rawcode for the ability. The convention used here by default is:
// Zx followed by an uppercase letter, unique to the bonus, followed by a 0-9-a-z representing
// the base of two the ability applys.
//
// The second parameter is the display value of the ability. This is so that they all line up
// neatly in the object editor.
//
// The third parameter is the actual value the bonus ability applys.
//
// Note that you should copy this in to its own trigger, save once, close the map and re-open
// it in the World Editor, then disable the trigger you copied this in to. If you do not
// disable the trigger, saving will take an insane ammount of time every time you save. If you
// make any changes below, you can simply enable the trigger again, save again, then disable
// the trigger again.
// CSS - Armor
//============================================================================================
//! textmacro ArmorAbility takes RAWCODE, DISPLAYVALUE, VALUE
//! external ObjectMerger w3a AId1 $RAWCODE$ Idef 1 $VALUE$ anam "CSS - Armor ($DISPLAYVALUE$)" aite 0 ansf "" aart ReplaceableTextures\CommandButtons\BTNHumanArmorUpOne.blp
//! endtextmacro
//! runtextmacro ArmorAbility("ZxA0", "+00001", "1")
//! runtextmacro ArmorAbility("ZxA1", "+00002", "2")
//! runtextmacro ArmorAbility("ZxA2", "+00004", "4")
//! runtextmacro ArmorAbility("ZxA3", "+00008", "8")
//! runtextmacro ArmorAbility("ZxA4", "+00016", "16")
//! runtextmacro ArmorAbility("ZxA5", "+00032", "32")
//! runtextmacro ArmorAbility("ZxA6", "+00064", "64")
//! runtextmacro ArmorAbility("ZxA7", "+00128", "128")
//! runtextmacro ArmorAbility("ZxA8", "+00256", "256")
//! runtextmacro ArmorAbility("ZxA9", "+00512", "512")
//! runtextmacro ArmorAbility("ZxAa", "+01024", "1024")
//! runtextmacro ArmorAbility("ZxAb", "+02048", "2048")
//! runtextmacro ArmorAbility("ZxAc", "+04096", "4096")
//! runtextmacro ArmorAbility("ZxAd", "+08192", "8192")
//! runtextmacro ArmorAbility("ZxAe", "+16384", "16384")
//! runtextmacro ArmorAbility("ZxAf", "+32768", "32768")
//! runtextmacro ArmorAbility("ZxAg", "+65536", "65536")
//! runtextmacro ArmorAbility("ZxAh", "-131072", "-131072")
// CSS - Damage
//============================================================================================
//! textmacro DamageAbility takes RAWCODE, DISPLAYVALUE, VALUE
//! external ObjectMerger w3a AItg $RAWCODE$ Iatt 1 $VALUE$ anam "CSS - Damage ($DISPLAYVALUE$)" aite 0 ansf "" aart ReplaceableTextures\CommandButtons\BTNClawsOfAttack.blp
//! endtextmacro
//! runtextmacro DamageAbility("ZxB0", "+00001", "1")
//! runtextmacro DamageAbility("ZxB1", "+00002", "2")
//! runtextmacro DamageAbility("ZxB2", "+00004", "4")
//! runtextmacro DamageAbility("ZxB3", "+00008", "8")
//! runtextmacro DamageAbility("ZxB4", "+00016", "16")
//! runtextmacro DamageAbility("ZxB5", "+00032", "32")
//! runtextmacro DamageAbility("ZxB6", "+00064", "64")
//! runtextmacro DamageAbility("ZxB7", "+00128", "128")
//! runtextmacro DamageAbility("ZxB8", "+00256", "256")
//! runtextmacro DamageAbility("ZxB9", "+00512", "512")
//! runtextmacro DamageAbility("ZxBa", "+01024", "1024")
//! runtextmacro DamageAbility("ZxBb", "+02048", "2048")
//! runtextmacro DamageAbility("ZxBc", "+04096", "4096")
//! runtextmacro DamageAbility("ZxBd", "+08192", "8192")
//! runtextmacro DamageAbility("ZxBe", "+16384", "16384")
//! runtextmacro DamageAbility("ZxBf", "+32768", "32768")
//! runtextmacro DamageAbility("ZxBg", "+65536", "65536")
//! runtextmacro DamageAbility("ZxBh", "-131072", "-131072")
// CSS - Sight Range
//============================================================================================
//! textmacro SightRangeAbility takes RAWCODE, DISPLAYVALUE, VALUE
//! external ObjectMerger w3a AIsi $RAWCODE$ Isib 1 $VALUE$ anam "CSS - Sight Range ($DISPLAYVALUE$)" aite 0 ansf "" aart ReplaceableTextures\CommandButtons\BTNTelescope.blp
//! endtextmacro
//! runtextmacro SightRangeAbility("ZxC0", "+00001", "1")
//! runtextmacro SightRangeAbility("ZxC1", "+00002", "2")
//! runtextmacro SightRangeAbility("ZxC2", "+00004", "4")
//! runtextmacro SightRangeAbility("ZxC3", "+00008", "8")
//! runtextmacro SightRangeAbility("ZxC4", "+00016", "16")
//! runtextmacro SightRangeAbility("ZxC5", "+00032", "32")
//! runtextmacro SightRangeAbility("ZxC6", "+00064", "64")
//! runtextmacro SightRangeAbility("ZxC7", "+00128", "128")
//! runtextmacro SightRangeAbility("ZxC8", "+00256", "256")
//! runtextmacro SightRangeAbility("ZxC9", "+00512", "512")
//! runtextmacro SightRangeAbility("ZxCa", "+01024", "1024")
//! runtextmacro SightRangeAbility("ZxCb", "+02048", "2048")
//! runtextmacro SightRangeAbility("ZxCc", "+04096", "4096")
//! runtextmacro SightRangeAbility("ZxCd", "+08192", "8192")
//! runtextmacro SightRangeAbility("ZxCe", "+16384", "16384")
//! runtextmacro SightRangeAbility("ZxCf", "+32768", "32768")
//! runtextmacro SightRangeAbility("ZxCg", "+65536", "65536")
//! runtextmacro SightRangeAbility("ZxCh", "-131072", "-131072")
// CSS - Max Mana
//============================================================================================
//! textmacro MaxManaAbility takes RAWCODE, DISPLAYVALUE, VALUE
//! external ObjectMerger w3a AImz $RAWCODE$ Iman 1 $VALUE$ anam "CSS - Max Mana ($DISPLAYVALUE$)" aite 0 ansf "" aart ReplaceableTextures\CommandButtons\BTNPendantOfMana.blp
//! endtextmacro
//! runtextmacro MaxManaAbility("ZxD0", "+00001", "1")
//! runtextmacro MaxManaAbility("ZxD1", "+00002", "2")
//! runtextmacro MaxManaAbility("ZxD2", "+00004", "4")
//! runtextmacro MaxManaAbility("ZxD3", "+00008", "8")
//! runtextmacro MaxManaAbility("ZxD4", "+00016", "16")
//! runtextmacro MaxManaAbility("ZxD5", "+00032", "32")
//! runtextmacro MaxManaAbility("ZxD6", "+00064", "64")
//! runtextmacro MaxManaAbility("ZxD7", "+00128", "128")
//! runtextmacro MaxManaAbility("ZxD8", "+00256", "256")
//! runtextmacro MaxManaAbility("ZxD9", "+00512", "512")
//! runtextmacro MaxManaAbility("ZxDa", "+01024", "1024")
//! runtextmacro MaxManaAbility("ZxDb", "+02048", "2048")
//! runtextmacro MaxManaAbility("ZxDc", "+04096", "4096")
//! runtextmacro MaxManaAbility("ZxDd", "+08192", "8192")
//! runtextmacro MaxManaAbility("ZxDe", "+16384", "16384")
//! runtextmacro MaxManaAbility("ZxDf", "+32768", "32768")
//! runtextmacro MaxManaAbility("ZxDg", "+65536", "65536")
//! runtextmacro MaxManaAbility("ZxDh", "-131072", "-131072")
// CSS - Max Life
//============================================================================================
//! textmacro MaxLifeAbility takes RAWCODE, DISPLAYVALUE, VALUE
//! external ObjectMerger w3a AIlf $RAWCODE$ Ilif 1 $VALUE$ anam "CSS - Max Life ($DISPLAYVALUE$)" aite 0 ansf "" aart ReplaceableTextures\CommandButtons\BTNPeriapt1.blp
//! endtextmacro
//! runtextmacro MaxLifeAbility("ZxE0", "+00001", "1")
//! runtextmacro MaxLifeAbility("ZxE1", "+00002", "2")
//! runtextmacro MaxLifeAbility("ZxE2", "+00004", "4")
//! runtextmacro MaxLifeAbility("ZxE3", "+00008", "8")
//! runtextmacro MaxLifeAbility("ZxE4", "+00016", "16")
//! runtextmacro MaxLifeAbility("ZxE5", "+00032", "32")
//! runtextmacro MaxLifeAbility("ZxE6", "+00064", "64")
//! runtextmacro MaxLifeAbility("ZxE7", "+00128", "128")
//! runtextmacro MaxLifeAbility("ZxE8", "+00256", "256")
//! runtextmacro MaxLifeAbility("ZxE9", "+00512", "512")
//! runtextmacro MaxLifeAbility("ZxEa", "+01024", "1024")
//! runtextmacro MaxLifeAbility("ZxEb", "+02048", "2048")
//! runtextmacro MaxLifeAbility("ZxEc", "+04096", "4096")
//! runtextmacro MaxLifeAbility("ZxEd", "+08192", "8192")
//! runtextmacro MaxLifeAbility("ZxEe", "+16384", "16384")
//! runtextmacro MaxLifeAbility("ZxEf", "+32768", "32768")
//! runtextmacro MaxLifeAbility("ZxEg", "+65536", "65536")
//! runtextmacro MaxLifeAbility("ZxEh", "-131072", "-131072")
// CSS - Strength
//============================================================================================
//! textmacro HeroStrAbility takes RAWCODE, DISPLAYVALUE, VALUE
//! external ObjectMerger w3a AIa1 $RAWCODE$ Iagi 1 0 Iint 1 0 Istr 1 $VALUE$ anam "CSS - Hero STR ($DISPLAYVALUE$)" aite 0 ansf "" aart ReplaceableTextures\CommandButtons\BTNGauntletsOfOgrePower.blp
//! endtextmacro
//! runtextmacro HeroStrAbility("ZxF0", "+00001", "1")
//! runtextmacro HeroStrAbility("ZxF1", "+00002", "2")
//! runtextmacro HeroStrAbility("ZxF2", "+00004", "4")
//! runtextmacro HeroStrAbility("ZxF3", "+00008", "8")
//! runtextmacro HeroStrAbility("ZxF4", "+00016", "16")
//! runtextmacro HeroStrAbility("ZxF5", "+00032", "32")
//! runtextmacro HeroStrAbility("ZxF6", "+00064", "64")
//! runtextmacro HeroStrAbility("ZxF7", "+00128", "128")
//! runtextmacro HeroStrAbility("ZxF8", "+00256", "256")
//! runtextmacro HeroStrAbility("ZxF9", "+00512", "512")
//! runtextmacro HeroStrAbility("ZxFa", "+01024", "1024")
//! runtextmacro HeroStrAbility("ZxFb", "+02048", "2048")
//! runtextmacro HeroStrAbility("ZxFc", "+04096", "4096")
//! runtextmacro HeroStrAbility("ZxFd", "+08192", "8192")
//! runtextmacro HeroStrAbility("ZxFe", "+16384", "16384")
//! runtextmacro HeroStrAbility("ZxFf", "+32768", "32768")
//! runtextmacro HeroStrAbility("ZxFg", "+65536", "65536")
//! runtextmacro HeroStrAbility("ZxFh", "-131072", "-131072")
// CSS - Agility
//============================================================================================
//! textmacro HeroAgiAbility takes RAWCODE, DISPLAYVALUE, VALUE
//! external ObjectMerger w3a AIa1 $RAWCODE$ Iagi 1 $VALUE$ Iint 1 0 Istr 1 0 anam "CSS - Hero AGI ($DISPLAYVALUE$)" aite 0 ansf "" aart ReplaceableTextures\CommandButtons\BTNSlippersOfAgility.blp
//! endtextmacro
//! runtextmacro HeroAgiAbility("ZxG0", "+00001", "1")
//! runtextmacro HeroAgiAbility("ZxG1", "+00002", "2")
//! runtextmacro HeroAgiAbility("ZxG2", "+00004", "4")
//! runtextmacro HeroAgiAbility("ZxG3", "+00008", "8")
//! runtextmacro HeroAgiAbility("ZxG4", "+00016", "16")
//! runtextmacro HeroAgiAbility("ZxG5", "+00032", "32")
//! runtextmacro HeroAgiAbility("ZxG6", "+00064", "64")
//! runtextmacro HeroAgiAbility("ZxG7", "+00128", "128")
//! runtextmacro HeroAgiAbility("ZxG8", "+00256", "256")
//! runtextmacro HeroAgiAbility("ZxG9", "+00512", "512")
//! runtextmacro HeroAgiAbility("ZxGa", "+01024", "1024")
//! runtextmacro HeroAgiAbility("ZxGb", "+02048", "2048")
//! runtextmacro HeroAgiAbility("ZxGc", "+04096", "4096")
//! runtextmacro HeroAgiAbility("ZxGd", "+08192", "8192")
//! runtextmacro HeroAgiAbility("ZxGe", "+16384", "16384")
//! runtextmacro HeroAgiAbility("ZxGf", "+32768", "32768")
//! runtextmacro HeroAgiAbility("ZxGg", "+65536", "65536")
//! runtextmacro HeroAgiAbility("ZxGh", "-131072", "-131072")
// CSS - Intelligence
//============================================================================================
//! textmacro HeroIntAbility takes RAWCODE, DISPLAYVALUE, VALUE
//! external ObjectMerger w3a AIa1 $RAWCODE$ Iagi 1 0 Iint 1 $VALUE$ Istr 1 0 anam "CSS - Hero INT ($DISPLAYVALUE$)" aite 0 ansf "" aart ReplaceableTextures\CommandButtons\BTNMantle.blp
//! endtextmacro
//! runtextmacro HeroIntAbility("ZxH0", "+00001", "1")
//! runtextmacro HeroIntAbility("ZxH1", "+00002", "2")
//! runtextmacro HeroIntAbility("ZxH2", "+00004", "4")
//! runtextmacro HeroIntAbility("ZxH3", "+00008", "8")
//! runtextmacro HeroIntAbility("ZxH4", "+00016", "16")
//! runtextmacro HeroIntAbility("ZxH5", "+00032", "32")
//! runtextmacro HeroIntAbility("ZxH6", "+00064", "64")
//! runtextmacro HeroIntAbility("ZxH7", "+00128", "128")
//! runtextmacro HeroIntAbility("ZxH8", "+00256", "256")
//! runtextmacro HeroIntAbility("ZxH9", "+00512", "512")
//! runtextmacro HeroIntAbility("ZxHa", "+01024", "1024")
//! runtextmacro HeroIntAbility("ZxHb", "+02048", "2048")
//! runtextmacro HeroIntAbility("ZxHc", "+04096", "4096")
//! runtextmacro HeroIntAbility("ZxHd", "+08192", "8192")
//! runtextmacro HeroIntAbility("ZxHe", "+16384", "16384")
//! runtextmacro HeroIntAbility("ZxHf", "+32768", "32768")
//! runtextmacro HeroIntAbility("ZxHg", "+65536", "65536")
//! runtextmacro HeroIntAbility("ZxHh", "-131072", "-131072")
// CSS - Attack Speed
//============================================================================================
//! textmacro AttackSpeedAbility takes RAWCODE, DISPLAYVALUE, VALUE
//! external ObjectMerger w3a AIsx $RAWCODE$ Isx1 1 $VALUE$ anam "CSS - Attack Speed ($DISPLAYVALUE$)" aite 0 ansf "" aart ReplaceableTextures\CommandButtons\BTNGlove.blp
//! endtextmacro
//! runtextmacro AttackSpeedAbility("ZxI0", "+00001", "0.01")
//! runtextmacro AttackSpeedAbility("ZxI1", "+00002", "0.02")
//! runtextmacro AttackSpeedAbility("ZxI2", "+00004", "0.04")
//! runtextmacro AttackSpeedAbility("ZxI3", "+00008", "0.08")
//! runtextmacro AttackSpeedAbility("ZxI4", "+00016", "0.16")
//! runtextmacro AttackSpeedAbility("ZxI5", "+00032", "0.32")
//! runtextmacro AttackSpeedAbility("ZxI6", "+00064", "0.64")
//! runtextmacro AttackSpeedAbility("ZxI7", "+00128", "1.28")
//! runtextmacro AttackSpeedAbility("ZxI8", "+00256", "2.56")
//! runtextmacro AttackSpeedAbility("ZxI9", "+00512", "5.12")
//! runtextmacro AttackSpeedAbility("ZxIa", "+01024", "10.24")
//! runtextmacro AttackSpeedAbility("ZxIb", "+02048", "20.48")
//! runtextmacro AttackSpeedAbility("ZxIc", "+04096", "40.96")
//! runtextmacro AttackSpeedAbility("ZxId", "+08192", "81.92")
//! runtextmacro AttackSpeedAbility("ZxIe", "+16384", "163.84")
//! runtextmacro AttackSpeedAbility("ZxIf", "+32768", "327.68")
//! runtextmacro AttackSpeedAbility("ZxIg", "+65536", "655.36")
//! runtextmacro AttackSpeedAbility("ZxIh", "-131072", "-1310.72")
// CSS - Life Regeneration
//============================================================================================
//! textmacro LifeRegenAbility takes RAWCODE, DISPLAYVALUE, VALUE
//! external ObjectMerger w3a Arel $RAWCODE$ Ihpr 1 $VALUE$ anam "CSS - Life Regen ($DISPLAYVALUE$)" aite 0 ansf "" aart ReplaceableTextures\CommandButtons\BTNRingSkull.blp
//! endtextmacro
//! runtextmacro LifeRegenAbility("ZxJ0", "+00001", "1")
//! runtextmacro LifeRegenAbility("ZxJ1", "+00002", "2")
//! runtextmacro LifeRegenAbility("ZxJ2", "+00004", "4")
//! runtextmacro LifeRegenAbility("ZxJ3", "+00008", "8")
//! runtextmacro LifeRegenAbility("ZxJ4", "+00016", "16")
//! runtextmacro LifeRegenAbility("ZxJ5", "+00032", "32")
//! runtextmacro LifeRegenAbility("ZxJ6", "+00064", "64")
//! runtextmacro LifeRegenAbility("ZxJ7", "+00128", "128")
//! runtextmacro LifeRegenAbility("ZxJ8", "+00256", "256")
//! runtextmacro LifeRegenAbility("ZxJ9", "+00512", "512")
//! runtextmacro LifeRegenAbility("ZxJa", "+01024", "1024")
//! runtextmacro LifeRegenAbility("ZxJb", "+02048", "2048")
//! runtextmacro LifeRegenAbility("ZxJc", "+04096", "4096")
//! runtextmacro LifeRegenAbility("ZxJd", "+08192", "8192")
//! runtextmacro LifeRegenAbility("ZxJe", "+16384", "16384")
//! runtextmacro LifeRegenAbility("ZxJf", "+32768", "32768")
//! runtextmacro LifeRegenAbility("ZxJg", "+65536", "65536")
//! runtextmacro LifeRegenAbility("ZxJh", "-131072", "-131072")
// CSS - Mana Regeneration
//============================================================================================
//! textmacro ManaRegenAbility takes RAWCODE, DISPLAYVALUE, VALUE
//! external ObjectMerger w3a AIrm $RAWCODE$ Imrp 1 $VALUE$ anam "CSS - Mana Regen ($DISPLAYVALUE$)" aite 0 ansf "" aart ReplaceableTextures\CommandButtons\BTNSobiMask.blp
//! endtextmacro
//! runtextmacro ManaRegenAbility("ZxK0", "+00001", "0.01")
//! runtextmacro ManaRegenAbility("ZxK1", "+00002", "0.02")
//! runtextmacro ManaRegenAbility("ZxK2", "+00004", "0.04")
//! runtextmacro ManaRegenAbility("ZxK3", "+00008", "0.08")
//! runtextmacro ManaRegenAbility("ZxK4", "+00016", "0.16")
//! runtextmacro ManaRegenAbility("ZxK5", "+00032", "0.32")
//! runtextmacro ManaRegenAbility("ZxK6", "+00064", "0.64")
//! runtextmacro ManaRegenAbility("ZxK7", "+00128", "1.28")
//! runtextmacro ManaRegenAbility("ZxK8", "+00256", "2.56")
//! runtextmacro ManaRegenAbility("ZxK9", "+00512", "5.12")
//! runtextmacro ManaRegenAbility("ZxKa", "+01024", "10.24")
//! runtextmacro ManaRegenAbility("ZxKb", "+02048", "20.48")
//! runtextmacro ManaRegenAbility("ZxKc", "+04096", "40.96")
//! runtextmacro ManaRegenAbility("ZxKd", "+08192", "81.92")
//! runtextmacro ManaRegenAbility("ZxKe", "+16384", "163.84")
//! runtextmacro ManaRegenAbility("ZxKf", "+32768", "327.68")
//! runtextmacro ManaRegenAbility("ZxKg", "+65536", "655.36")
//! runtextmacro ManaRegenAbility("ZxKh", "-131072", "-1310.72")
// Don't let a //! external command be the last line in a trigger!
//TESH.scrollpos=0
//TESH.alwaysfold=0
// A Code Patch for the Implementation Macro bug with Life Regen abilities found in v1.5i
// I am awfully sorry for this critical error and hope for your forgiveness.
// This patch will be run just like the Implementation Macro. Follow the exact same steps and
// you are done. Thank you and have a nice day.
// Doomlord
// CSS - Life Regeneration
//============================================================================================
//! textmacro LifeRegenAbility takes RAWCODE, DISPLAYVALUE, VALUE
//! external ObjectMerger w3a Arel $RAWCODE$ Ihpr 1 $VALUE$ anam "CSS - Life Regen ($DISPLAYVALUE$)" aite 0 ansf "" aart ReplaceableTextures\CommandButtons\BTNRingSkull.blp
//! endtextmacro
//! runtextmacro LifeRegenAbility("ZxJ0", "+00001", "1")
//! runtextmacro LifeRegenAbility("ZxJ1", "+00002", "2")
//! runtextmacro LifeRegenAbility("ZxJ2", "+00004", "4")
//! runtextmacro LifeRegenAbility("ZxJ3", "+00008", "8")
//! runtextmacro LifeRegenAbility("ZxJ4", "+00016", "16")
//! runtextmacro LifeRegenAbility("ZxJ5", "+00032", "32")
//! runtextmacro LifeRegenAbility("ZxJ6", "+00064", "64")
//! runtextmacro LifeRegenAbility("ZxJ7", "+00128", "128")
//! runtextmacro LifeRegenAbility("ZxJ8", "+00256", "256")
//! runtextmacro LifeRegenAbility("ZxJ9", "+00512", "512")
//! runtextmacro LifeRegenAbility("ZxJa", "+01024", "1024")
//! runtextmacro LifeRegenAbility("ZxJb", "+02048", "2048")
//! runtextmacro LifeRegenAbility("ZxJc", "+04096", "4096")
//! runtextmacro LifeRegenAbility("ZxJd", "+08192", "8192")
//! runtextmacro LifeRegenAbility("ZxJe", "+16384", "16384")
//! runtextmacro LifeRegenAbility("ZxJf", "+32768", "32768")
//! runtextmacro LifeRegenAbility("ZxJg", "+65536", "65536")
//! runtextmacro LifeRegenAbility("ZxJh", "-131072", "-131072")
function Init_Text takes nothing returns nothing
call DisplayTimedTextToPlayer(GetLocalPlayer (), 0, 0, 10, "\nType -iteminfo <itemslot> to show the selected unit's item's info in the chosen slot")
call DisplayTimedTextToPlayer(GetLocalPlayer (), 0, 0, 10, "Type -itemsocketinfo <itemslot> to show the selected unit's item's info in the chosen slot")
call DestroyTimer (GetExpiredTimer())
endfunction
function Init_Timer takes nothing returns nothing
call TimerStart (CreateTimer(), 0.00, false, function Init_Text)
endfunction
//===========================================================================
function InitTrig_Init_Copy takes nothing returns nothing
call Init_Timer()
endfunction
function Trig_Untitled_Trigger_002_Copy_Actions takes nothing returns nothing
call CSS_StatUpdate ( gg_unit_Hpal_0022 )
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_002_Copy takes nothing returns nothing
set gg_trg_Untitled_Trigger_002_Copy = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Untitled_Trigger_002_Copy, Player(0), "2", true )
call TriggerAddAction( gg_trg_Untitled_Trigger_002_Copy, function Trig_Untitled_Trigger_002_Copy_Actions )
endfunction
function Trig_Untitled_Trigger_005_Actions takes nothing returns nothing
call CSS_AddBonus (gg_unit_Hpal_0022, S2I(SubString(GetEventPlayerChatString(), 6, StringLength(GetEventPlayerChatString()))), 9)
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_005 takes nothing returns nothing
set gg_trg_Untitled_Trigger_005 = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Untitled_Trigger_005, Player(0), "-mana", false )
call TriggerAddAction( gg_trg_Untitled_Trigger_005, function Trig_Untitled_Trigger_005_Actions )
endfunction
function Trig_Untitled_Trigger_003_Actions takes nothing returns nothing
call CSS_AddBonus (gg_unit_Hpal_0022, S2I(SubString(GetEventPlayerChatString(), 6, StringLength(GetEventPlayerChatString()))), 8)
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_003 takes nothing returns nothing
set gg_trg_Untitled_Trigger_003 = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Untitled_Trigger_003, Player(0), "-life", false )
call TriggerAddAction( gg_trg_Untitled_Trigger_003, function Trig_Untitled_Trigger_003_Actions )
endfunction
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
call CSS_AddBonus (gg_unit_Hpal_0022, S2I(SubString(GetEventPlayerChatString(), 5, StringLength(GetEventPlayerChatString()))), 2)
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
set gg_trg_Untitled_Trigger_001 = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Untitled_Trigger_001, Player(0), "-dmg", false )
call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction
function Trig_Untitled_Trigger_006_Actions takes nothing returns nothing
call CSS_AddBonus (gg_unit_Hpal_0022, S2I(SubString(GetEventPlayerChatString(), 7, StringLength(GetEventPlayerChatString()))), 0)
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_006 takes nothing returns nothing
set gg_trg_Untitled_Trigger_006 = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Untitled_Trigger_006, Player(0), "-armor", false )
call TriggerAddAction( gg_trg_Untitled_Trigger_006, function Trig_Untitled_Trigger_006_Actions )
endfunction
function Trig_Untitled_Trigger_007_Actions takes nothing returns nothing
call CSS_AddBonus (gg_unit_Hpal_0022, S2I(SubString(GetEventPlayerChatString(), 5, StringLength(GetEventPlayerChatString()))), 0)
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_007 takes nothing returns nothing
set gg_trg_Untitled_Trigger_007 = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Untitled_Trigger_007, Player(0), "-str", false )
call TriggerAddAction( gg_trg_Untitled_Trigger_007, function Trig_Untitled_Trigger_007_Actions )
endfunction
function Trig_Untitled_Trigger_008_Actions takes nothing returns nothing
call CSS_AddBonus (gg_unit_Hpal_0022, S2I(SubString(GetEventPlayerChatString(), 5, StringLength(GetEventPlayerChatString()))), 4)
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_008 takes nothing returns nothing
set gg_trg_Untitled_Trigger_008 = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Untitled_Trigger_008, Player(0), "-int", false )
call TriggerAddAction( gg_trg_Untitled_Trigger_008, function Trig_Untitled_Trigger_008_Actions )
endfunction
function Trig_Untitled_Trigger_009_Actions takes nothing returns nothing
call CSS_AddBonus (gg_unit_Hpal_0022, S2I(SubString(GetEventPlayerChatString(), 5, StringLength(GetEventPlayerChatString()))), 3)
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_009 takes nothing returns nothing
set gg_trg_Untitled_Trigger_009 = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Untitled_Trigger_009, Player(0), "-agi", false )
call TriggerAddAction( gg_trg_Untitled_Trigger_009, function Trig_Untitled_Trigger_009_Actions )
endfunction
function Trig_Untitled_Trigger_010_Actions takes nothing returns nothing
call CSS_AddBonus (gg_unit_Hpal_0022, S2I(SubString(GetEventPlayerChatString(), 4, StringLength(GetEventPlayerChatString()))), 1)
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_010 takes nothing returns nothing
set gg_trg_Untitled_Trigger_010 = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Untitled_Trigger_010, Player(0), "-as", false )
call TriggerAddAction( gg_trg_Untitled_Trigger_010, function Trig_Untitled_Trigger_010_Actions )
endfunction
function Trig_Untitled_Trigger_011_Actions takes nothing returns nothing
call CSS_AddBonus (gg_unit_Hpal_0022, S2I(SubString(GetEventPlayerChatString(), 7, StringLength(GetEventPlayerChatString()))), 10)
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_011 takes nothing returns nothing
set gg_trg_Untitled_Trigger_011 = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Untitled_Trigger_011, Player(0), "-sight", false )
call TriggerAddAction( gg_trg_Untitled_Trigger_011, function Trig_Untitled_Trigger_011_Actions )
endfunction
function Trig_Untitled_Trigger_012_Actions takes nothing returns nothing
call CSS_AddBonus (gg_unit_Hpal_0022, S2I(SubString(GetEventPlayerChatString(), 11, StringLength(GetEventPlayerChatString()))), 6)
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_012 takes nothing returns nothing
set gg_trg_Untitled_Trigger_012 = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Untitled_Trigger_012, Player(0), "-liferegen", false )
call TriggerAddAction( gg_trg_Untitled_Trigger_012, function Trig_Untitled_Trigger_012_Actions )
endfunction
function Trig_Untitled_Trigger_013_Actions takes nothing returns nothing
call CSS_AddBonus (gg_unit_Hpal_0022, S2I(SubString(GetEventPlayerChatString(), 11, StringLength(GetEventPlayerChatString()))), 7)
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_013 takes nothing returns nothing
set gg_trg_Untitled_Trigger_013 = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Untitled_Trigger_013, Player(0), "-manaregen", false )
call TriggerAddAction( gg_trg_Untitled_Trigger_013, function Trig_Untitled_Trigger_013_Actions )
endfunction