//===========================================================================
//
// script : cp (control panel) core
// version : 1.10
// date : 29.08.2004
//
//
// made by : DimonT
// mail : [email protected]
// icq : 937160
// www : http://wc3.xgm.ru
//
//===========================================================================
//
// Module API :
//
// Init:
//
// cp_SetTrackableGroup
// cp_BuildGroupIDs
//
// General:
//
// cp_GetTrackableGroup
// cp_GetTrackableGroupID
// cp_GetTrackableIDByGroup
// cp_GetHoveredTrackable
// cp_GetClickedTrackable
// cp_GetLastClickedTrackable
// cp_GetTrackableLocation
//
// Text Tags:
//
// cp_DrawText
// cp_UpdateText
//
//
//
// Effects:
//
// cp_HighlightCell
// cp_IsCellHighlighted
// cp_UnHighlightAll
// cp_SelectCell
// cp_SelectedCell
// cp_CreateBackgroundEffect
// cp_CreateBackgroundEffectXY
// cp_CreateEffect
// cp_CreateEffectXY
//
// Callback Functions:
//
// cp_[modname]_Init
// cp_[modname]_ClickHandler
// cp_[modname]_HoverHandler
// cp_[modname]_RefreshTextTags
// cp_[modname]_Exit
//
//
// In Game API:
//
// cp_Enable
// cp_LoadModule
//
//
//===========================================================================
//===========================================================================
function echo takes integer playerID, string msg returns nothing
call DisplayTimedTextToPlayer(Player(playerID),0,0,5.00, msg)
endfunction
//===========================================================================
function debugMsg takes string msg returns nothing
call echo(0, "|c00aaaaaadebug:|r " + msg)
endfunction
//===========================================================================
function chr takes integer i returns string
local string abc = "abcdefghijklmnopqrstuvwxyz"
local string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
local string digits = "0123456789"
if i >= 65 and i <= 90 then
return SubString(ABC, i-65,i-64)
elseif i >= 97 and i <= 122 then
return SubString(abc, i-97,i-96)
elseif i >= 48 and i <= 57 then
return SubString(digits, i-48,i-47)
endif
return ""
endfunction
//===========================================================================
function iif takes boolean cond, string s1, string s2 returns string
if cond then
return s1
endif
return s2
endfunction
//===========================================================================
function Trackable2Integer takes trackable tk returns integer
return tk
return 0
endfunction
//===========================================================================
function cp_GetTrackableID takes trackable tk returns integer
local integer i = 0
local integer itk = Trackable2Integer(tk)
loop
exitwhen i > 200
if udg_cp_Trackables[i] == itk then
return i
endif
set i = i + 1
endloop
return -1
endfunction
//===========================================================================
function cp_BuildGroupIDs takes nothing returns nothing
local integer i = 0
local integer array count
loop
exitwhen i > 200
if udg_cp_Data[i] != -1 then
set udg_cp_Data[i+200] = count[udg_cp_Data[i]]
set count[udg_cp_Data[i]] = count[udg_cp_Data[i]] + 1
else
set udg_cp_Data[i+200] = -1
endif
set i = i + 1
endloop
endfunction
//===========================================================================
function cp_SetTrackableGroup takes integer tid, integer g returns nothing
set udg_cp_Data[tid] = g
endfunction
//===========================================================================
function cp_GetTrackableGroup takes integer tid returns integer
if tid < 0 then
return -1
endif
return udg_cp_Data[tid]
endfunction
//===========================================================================
function cp_GetTrackableGroupID takes integer tid returns integer
if tid < 0 then
return -1
endif
return udg_cp_Data[200+tid]
endfunction
//===========================================================================
function cp_GetTrackableIDByGroup takes integer g, integer gid returns integer
local integer i = 0
loop
exitwhen i >= 200
if udg_cp_Data[i] == g and udg_cp_Data[i+200] == gid then
return i
endif
set i = i + 1
endloop
return -1
endfunction
//===========================================================================
function cp_GetHoveredTrackable takes nothing returns integer
return udg_cp_Data[1000]
endfunction
//===========================================================================
function cp_GetClickedTrackable takes nothing returns integer
return udg_cp_Data[1001]
endfunction
//===========================================================================
function cp_GetLastClickedTrackable takes nothing returns integer
return udg_cp_Data[1002]
endfunction
//===========================================================================
function cp_GetTrackableLocation takes integer tid returns location
call RemoveLocation(udg_cp_TrackableLoc)
if tid >= 0 then
set udg_cp_TrackableLoc = Location(udg_cp_BaseX + 74 + ModuloInteger(tid, 20) * 100, udg_cp_BaseY - 62 + 1024 - tid/20 * 100)
else
set udg_cp_TrackableLoc = Location(udg_cp_BaseX, udg_cp_BaseY)
endif
return udg_cp_TrackableLoc
endfunction
//===========================================================================
function cp_DrawText takes integer ttid, real x, real y, real size, string msg returns nothing
local texttag tt
if msg == "" and x == 0 and y == 0 then
return
endif
if size == 0 then
set size = 0.023
endif
call DestroyTextTag(udg_cp_TextTag[ttid])
set tt = CreateTextTag()
call SetTextTagPos(tt, x, y, 0)
call SetTextTagColor(tt, 255,255,255,255)
call SetTextTagVelocity(tt, 0,0)
call SetTextTagVisibility(tt, true)
call SetTextTagText(tt, msg,size)
set udg_cp_TextTag[ttid] = tt
endfunction
//===========================================================================
function cp_UpdateText takes integer ttid, real x, real y, real size, string msg returns nothing
if udg_cp_TextTag[ttid] == null then
call cp_DrawText(ttid, x, y, size, msg)
endif
if msg == "" and x == 0 and y == 0 then
call DestroyTextTag(udg_cp_TextTag[ttid])
set udg_cp_TextTag[ttid] = null
return
endif
if size == 0 then
set size = 0.023
endif
call SetTextTagText(udg_cp_TextTag[ttid], msg, size)
if x != 0 or y != 0 then
call SetTextTagPos(udg_cp_TextTag[ttid], x, y, 0)
endif
endfunction
//===========================================================================
function cp_RefreshTextTags takes nothing returns nothing
if udg_cp_Enabled then
call ExecuteFunc("cp_"+udg_cp_Module+"_RefreshTextTags")
call ExecuteFunc("cp_"+udg_cp_Module+"_HoverHandler")
endif
endfunction
//===========================================================================
function cp_HighlightCell takes integer tid, boolean enable, string modelfile returns nothing
call DestroyEffect(udg_cp_Effects[tid])
if enable then
if modelfile == "" then
set modelfile = "Objects\\InventoryItems\\TreasureChest\\treasurechest.mdl"
endif
set udg_cp_Effects[tid] = AddSpecialEffectLoc(modelfile, cp_GetTrackableLocation(tid))
set udg_cp_Data[400+tid] = 1
else
set udg_cp_Data[400+tid] = 0
endif
endfunction
//===========================================================================
function cp_IsCellHighlighted takes integer tid returns boolean
return udg_cp_Data[400+tid] == 1
endfunction
//===========================================================================
function cp_UnHighlightAll takes nothing returns nothing
local integer i = 0
loop
exitwhen i >= 200
call cp_HighlightCell(i, false, "")
set i = i + 1
endloop
endfunction
//===========================================================================
function cp_SelectCell takes integer tid, string modelfile returns nothing
call DestroyEffect(udg_cp_Effects[200])
set udg_cp_Data[1003] = tid
if tid != -1 then
if modelfile == "" then
set modelfile = "selector.mdx"
endif
set udg_cp_Effects[200] = AddSpecialEffectLoc(modelfile, cp_GetTrackableLocation(tid))
endif
endfunction
//===========================================================================
function cp_SelectedCell takes nothing returns integer
return udg_cp_Data[1003]
endfunction
//===========================================================================
function cp_CreateBackgroundEffectXY takes string modelfile, real x, real y returns nothing
// local integer i = 500
// loop
// exitwhen i >= 1000 or udg_cp_Effects[i] == null
// set i = i + 1
// endloop
// if i == 1000 then
// return
// endif
set udg_cp_Effects[udg_cp_Data[1004]] = AddSpecialEffect(modelfile, x, y)
set udg_cp_Data[1004] = udg_cp_Data[1004] + 1
endfunction
//===========================================================================
function cp_CreateBackgroundEffect takes string modelfile, integer tid returns nothing
call cp_CreateBackgroundEffectXY(modelfile, GetLocationX(cp_GetTrackableLocation(tid)), GetLocationY(cp_GetTrackableLocation(tid)))
endfunction
//===========================================================================
function cp_CreateEffectXY takes integer id, string modelfile, real x, real y returns nothing
call DestroyEffect(udg_cp_Effects[201 + id])
if modelfile != "" then
set udg_cp_Effects[201 + id] = AddSpecialEffect(modelfile, x, y)
endif
endfunction
//===========================================================================
function cp_CreateEffect takes integer id, string modelfile, integer tid returns nothing
call cp_CreateEffectXY(id, modelfile, GetLocationX(cp_GetTrackableLocation(tid)), GetLocationY(cp_GetTrackableLocation(tid)))
endfunction
//===========================================================================
function cp_ClickHandler takes nothing returns nothing
local integer tid = cp_GetTrackableID(GetTriggeringTrackable())
if not udg_cp_Enabled or cp_GetTrackableGroup(tid) == -1 then
return
endif
set udg_cp_Data[1002] = udg_cp_Data[1001]
set udg_cp_Data[1001] = tid
call ExecuteFunc("cp_"+udg_cp_Module+"_ClickHandler")
endfunction
//===========================================================================
function cp_HoverHandler takes nothing returns nothing
local integer tid = cp_GetTrackableID(GetTriggeringTrackable())
if not udg_cp_Enabled then
return
endif
if cp_GetTrackableGroup(tid) == -1 then
set udg_cp_Data[1000] = -1
else
set udg_cp_Data[1000] = tid
endif
call ExecuteFunc("cp_"+udg_cp_Module+"_HoverHandler")
endfunction
//===========================================================================
function cp_Enable takes boolean enable returns nothing
local real x = udg_cp_BaseX + 1024
local real y = udg_cp_BaseY + 512
local integer i = 0
if udg_cp_Enabled == enable then
return
endif
if enable then
// ########## save camera loc ###########
set udg_cp_RData[0] = GetCameraTargetPositionX()
set udg_cp_RData[1] = GetCameraTargetPositionY()
// ############# set camera #############
call SetCameraPosition(x,y)
call SetCameraBounds(x,y,x,y,x,y,x,y)
call EnableTrigger(gg_trg_force_camera_while_in_cp)
call TriggerExecute(gg_trg_force_camera_while_in_cp)
// ######## do background picture #######
call SetCineFilterTexture("ReplaceableTextures\\CameraMasks\\cp_"+udg_cp_Module+".tga")
call SetCineFilterBlendMode(ConvertBlendMode(2))
call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE)
call SetCineFilterStartUV(0, 0, 1, 1)
call SetCineFilterEndUV(0, 0, 1, 1)
call SetCineFilterStartColor(255,255,255,255)
call SetCineFilterEndColor(255,255,255,255)
call SetCineFilterDuration(0)
call DisplayCineFilter(true)
set udg_cp_RData[2] = GetTimeOfDay()
call SetTimeOfDay(12)
call SuspendTimeOfDay(true)
// ############## init vars #############
set udg_cp_Enabled = true
set udg_cp_Data[1000] = -1
set udg_cp_Data[1001] = -1
set udg_cp_Data[1002] = -1
set udg_cp_Data[1003] = -1
set udg_cp_Data[1004] = 500
loop
exitwhen i >= 200
set udg_cp_Data[i] = -1
set udg_cp_Effects[i] = null
set udg_cp_TextTag[i] = null
set i = i + 1
endloop
loop
exitwhen i >= 1000
set udg_cp_Data[i] = 0
set udg_cp_Effects[i] = null
set i = i + 1
endloop
// ##### exec module init functions #####
call ExecuteFunc("cp_"+udg_cp_Module+"_Init")
call cp_BuildGroupIDs()
call cp_RefreshTextTags()
else
// ##### exec module shutdown func #####
call ExecuteFunc("cp_"+udg_cp_Module+"_Exit")
// ########## do some cleanup ###########
loop
exitwhen i >= 200
call DestroyEffect(udg_cp_Effects[i])
call DestroyTextTag(udg_cp_TextTag[i])
set i = i + 1
endloop
loop
exitwhen i >= 1000
call DestroyEffect(udg_cp_Effects[i])
set i = i + 1
endloop
// ############ reset camera ############
call DisableTrigger( gg_trg_force_camera_while_in_cp )
call SetCameraBoundsToRect(bj_mapInitialPlayableArea)
call ResetToGameCamera(0)
call SetCameraPosition(udg_cp_RData[0],udg_cp_RData[1])
call DisplayCineFilter(false)
call SetTimeOfDay(udg_cp_RData[2])
call SuspendTimeOfDay(false)
set udg_cp_Enabled = false
endif
endfunction
//===========================================================================
function cp_LoadModule takes string modname returns nothing
if udg_cp_Enabled then
call cp_Enable(false)
endif
set udg_cp_Module = modname
call cp_Enable(true)
endfunction
Name | Type | is_array | initial_value |
Astatsleft | integer | No | 5 |
cp_BaseX | real | No | |
cp_BaseY | real | No | |
cp_Data | integer | Yes | |
cp_Effects | effect | Yes | |
cp_Enabled | boolean | No | |
cp_Module | string | No | INV |
cp_RData | real | Yes | |
cp_TextTag | texttag | Yes | |
cp_TrackableLoc | location | No | |
cp_Trackables | integer | Yes | |
Hero | unit | No | |
INV_add_mode | boolean | No | |
INV_cache | gamecache | No | |
INV_cols | integer | No | 10 |
INV_Data | integer | Yes | |
INV_item | item | Yes | |
INV_rows | integer | No | 8 |
INV_sell_range | real | No | 400.00 |
INV_sell_rate | real | No | 0.50 |
INV_unit | unit | No | |
obj | gamecache | No | |
TESTHERO | unit | No | |
zAgility | button | No | |
zAttriubtes | dialog | No | |
zCancel | button | No | |
zIntelligence | button | No | |
zStrength | button | No |
// ###### Fullscreen Inventory Spell #######
//
// ### Table of Contents ###
//
// 1. Overview
// 2. Installing this to your map
// 3. Known issues
// 4. Creating your own fullscreen interfaces
// 5. Credits & contact info
// 6. Version History
//
// ### 1. Overview ###
//
// This spell enables your hero to pick up and carry a huge amount of items.
// It's multiplayer incompatible, and only one hero can hold the backpack at a time,
// so this is mainly designed for large singleplayer RPG maps, campaigns and mods.
//
// 1.1. Main Features:
// - Up to 80 extra slots;
// - Blizzard-like full screen interface, done for all 4 races;
// - No page-based navigation or typing anything in the chat:
// all controls are placed on the single screen and everything could be done by
// just clicking the left mouse button;
// - Amount of extra slots can be easily changed during the game
// (in example map, "inventory" ability is made 3-level, allowing more slots with each level)
// - Option to pick up/buy items directly into backpack;
// - Items can be sold directly from backpack if standing enough close to shop;
// - Instant-use items (such as healing potions) can be used directly from backpack;
//
// ### 2. Installing this to your map ###
//
// 2.1. In your target map, create a 'dead zone' of at least 32x32 cells in lower-left corner.
// (Means that it must be outside camera bounds, with a flat above-water terrain without any objects on it.)
// This can be easily achieved by extending your map bounds by 32 to the left while keeping the camera bounds intact.
//
// 2.2. Transfer all of the imported files from example map to your map.
// This is the hardest part, I recommend to use WinMPQ or some other MPQ tool
// since WE importer allows only to transfer 1 file at a time.
// Files to be transferred this way are all .mdx, .tga and .blp files, and war3map.imp file.
// Note you'll have to re-import all of your own custom files to the map after that,
// but anyway it's much easier than to import 285 files one-by-one.
//
// IMPORTANT: Don't forget to make a backup copy of your map before changing it with any MPQ tools,
// as they sometimes seem to damage the map archive so it becomes no longer openable in the WE.
//
// 2.3. Transfer all the triggers, variables and custom script.
// This could be easily done with the WE 'Import/Export Triggers' functionality if you're starting a new map,
// otherwise, copy & paste all trigger categories and custom script section (this shouldn't take more than 2 min).
// All the variables should be created automatically if you have appropriate setting enabled in the editor,
// if not then you'll need to manually re-create all the variables.
//
// 2.4. Transfer the custom ability. Just Ctrl-C + Ctrl-V.
//
// 2.5. Open the "init" trigger in the "game" category, tune up the variables -
// "INV_unit" must contain the unit who'll use the backpack,
// "INV_rows" and "INV_cols" are the initial dimensions of the backpack.
// All actions after "optional stuff" comment are placed just for testing purposes and should be removed.
//
// 2.6.1. If you want to disable an "upgradable backpack" functionality
// (you can still manually change its size at any point of the game via triggers
// by just setting "INV_rows" and "INV_cols" variables to desirable values),
// enable the "Add Inventory Screen to INV_unit" action in the trigger,
// then go to the Unit Editor and remove the "Inventory Screen" ability from hero's ability list.
// After that, kill the "increase inv capacity trigger" and a reference to it in the "init" trigger.
//
// 2.6.2. Otherwise, go in Unit Editor and add "Inventory Screen" to your hero unit's hero ability list.
//
// 2.7. Open the "inventory init item settings" trigger and, using the example provided,
// fill in information about your custom items.
// (since this information couldn't be extracted by the script, it has to be typed here manually)
// If you need to know 4-character item IDs of your custom items (something like 'Ixxx'), open the Item Editor then press Ctrl-D.
// Any custom items not registered in this manner will show up as a "?" sign in the game and have a name "Unknown Item ('Ixxx')".
//
// 2.8. Using the Game Cache to transfer items in backpack between maps:
//
// 2.8.1. In map you're leaving, among the other game cache stuff
// (you'll need it anyway at least to tranfer your hero, right?) insert the following statement:
// Custom Script - call INV_SaveToCache(udg_cache, "missionkey")
// Where "cache" is the reference to global gamecache variable
// (you may use bj_lastCreatedGameCache variable to refer last gamecache created via GUI triggers),
// and "missionkey" is what you specify as "Category" in other gamecache actions.
//
// 2.8.2. In the second map, place the following:
// Custom Script - call INV_LoadFromCache(udg_cache, "missionkey")
// The meaning of the parameters is exactly the same as above.
// Don't forget to do all of the common initialization stuff,
// such as assigning "INV_unit" variable to the unit you've probably just restored from the cache.
//
//
// ### 3. Known issues ###
//
// 3.1. It's only single player. Sorry, still know no way to make this multiplayer compatible ever.
//
// 3.2. Items in the backpack do not give their passive ability bonuses.
// BTW, just imagine a hero with 80 attack or stat bonus items :)
//
// 3.3. If your main inventory is full, "pickup to extended inventory" option won't work.
// (it'll display the "inventory is full" message)
// The only solution is to always keep at least one free slot in your main inventory.
//
// 3.4. If exit the inventory screen, then upgrade it to larger capacity then quickly re-enter,
// some of the models (borders and corners) will briefly flash.
// This is because of the lack of death animation on some models,
// so they're destroyed 5 seconds after "Destroy Effect" command is called.
// Going to be fixed in future versions, has no effect on functionality.
//
// 3.5. Items set to undroppable state still could be dropped via fullscreen interface.
// Future versions will have an option to completely disable item dropping
// as there's no way to detect undroppable state in JASS.
//
//
// ### 4. Creating your own fullscreen interfaces ###
//
// ... the documentation of all custom functions still to be written ...
// ... until that the only recommendation is to open the "inventory module" trigger ...
// ... and try to understand how it was done ...
//
//
// ### 5. Credits & contact info ###
//
// 5.1. DimonT - all of the triggers & JASS coding, fast icon model creating tools, and this readme file :)
// E-mail : [email protected]
// ICQ : 937160
//
// 5.2. Illisor - all of 3D-models & custom graphics.
// E-mail : [email protected]
// ICQ : 221013519
//
// XGM - Russian WC3 Modmaking Community
// http://wc3.xgm.ru
//
//
// ### 6. Version History ###
//
// 1.15 (31/08/2004)
// - fixed a bug allowing to duplicate charged items by clicking "Use Item" button twice;
// - fixed description box background in Orc skin;
// - this readme included.
//
// 1.10 (29/08/2004)
// - 4 skins, for all of the races;
// - ability to use & sell items from backpack;
// - item sell value is displayed;
// - support for game cache to transfer backpack contents between maps.
//
// 1.00 (23/08/2004)
// - initial release.
//===========================================================================
//===========================================================================
function InitTrig_readme_txt takes nothing returns nothing
endfunction
function Trig_cp_init_Actions takes nothing returns nothing
local integer i = 0
local integer j
local trigger t
local trackable tk
local texttag tt
// ############### set up workspace ##############
set udg_cp_BaseX = ( GetRectMinX(GetEntireMapRect()) + 100.00 )
set udg_cp_BaseY = ( GetRectMinY(GetEntireMapRect()) + 100.00 )
call FogModifierStart(CreateFogModifierRect(GetLocalPlayer(), FOG_OF_WAR_VISIBLE, Rect(udg_cp_BaseX, udg_cp_BaseY, udg_cp_BaseX + 2048, udg_cp_BaseY+1160), false, true))
// ############### set up trackable grid ##############
loop
exitwhen i >= 10
set j = 0
loop
exitwhen j >= 20
set tk = CreateTrackable("inventory.mdx", udg_cp_BaseX + 74 + (100*j), udg_cp_BaseY + 1024 - 62 - (100*i), 0)
set t = CreateTrigger()
call TriggerRegisterTrackableHitEvent(t, tk)
call TriggerAddAction(t, function cp_ClickHandler)
set t = CreateTrigger()
call TriggerRegisterTrackableTrackEvent(t, tk)
call TriggerAddAction(t, function cp_HoverHandler)
set udg_cp_Trackables[20*i+j] = Trackable2Integer(tk)
set j = j + 1
endloop
set i = i + 1
endloop
// ############### set up some triggers ##############
set t = CreateTrigger()
call TriggerRegisterTimerEventPeriodic( t, 30.00 )
call TriggerAddAction( t, function cp_RefreshTextTags )
endfunction
//===========================================================================
function InitTrig_cp_init takes nothing returns nothing
set gg_trg_cp_init = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_cp_init, 0.00 )
call TriggerAddAction( gg_trg_cp_init, function Trig_cp_init_Actions )
endfunction
function Trig_cp_exit_Actions takes nothing returns nothing
call cp_Enable(false)
endfunction
//===========================================================================
function InitTrig_cp_exit takes nothing returns nothing
set gg_trg_cp_exit = CreateTrigger( )
call TriggerRegisterPlayerEventEndCinematic( gg_trg_cp_exit, Player(0) )
call TriggerAddAction( gg_trg_cp_exit, function Trig_cp_exit_Actions )
endfunction
function Trig_force_camera_while_in_cp_Actions takes nothing returns nothing
call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, 269.00, 0 )
call SetCameraField(CAMERA_FIELD_ROTATION, 90.00, 0 )
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, 3100.00, 0 )
call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW, 44.00, 0 )
endfunction
//===========================================================================
function InitTrig_force_camera_while_in_cp takes nothing returns nothing
set gg_trg_force_camera_while_in_cp = CreateTrigger( )
call DisableTrigger( gg_trg_force_camera_while_in_cp )
call TriggerRegisterTimerEventPeriodic( gg_trg_force_camera_while_in_cp, 0.010 )
call TriggerAddAction( gg_trg_force_camera_while_in_cp, function Trig_force_camera_while_in_cp_Actions )
endfunction
//===========================================================================
//
// script : cp module - 80-slot inventory
// version : 1.15
// date : 31.08.2004
//
//
// made by : DimonT | Illisor
// mail : [email protected] | [email protected]
// icq : 937160 | 221013519
// www : http://wc3.xgm.ru
//
//
//===========================================================================
//===========================================================================
constant function INV_GetSkin takes nothing returns string
if GetPlayerRace(GetLocalPlayer()) == RACE_NIGHTELF then
return "4"
elseif GetPlayerRace(GetLocalPlayer()) == RACE_UNDEAD then
return "2"
elseif GetPlayerRace(GetLocalPlayer()) == RACE_ORC then
return "3"
endif
return "1"
endfunction
//===========================================================================
function ItemID2String takes integer itemid returns string
return chr(itemid/256/256/256) + chr(ModuloInteger(itemid/256/256, 256)) + chr(ModuloInteger(itemid/256, 256)) + chr(ModuloInteger(itemid, 256))
endfunction
//===========================================================================
function INV_UnitAddItemToSlot takes unit u, item it, integer slot returns nothing
local integer i = 0
loop
exitwhen i >= 6 or i > slot
if i < slot then
if UnitItemInSlot(u,i) == null then
call UnitAddItemById(u, 'phlt')
endif
elseif i == slot then
call UnitAddItem(u, it)
endif
set i = i + 1
endloop
set i = 0
loop
exitwhen i >= 6 or i >= slot
if GetItemTypeId(UnitItemInSlot(u,i)) == 'phlt' then
call RemoveItem(UnitItemInSlot(u,i))
endif
set i = i + 1
endloop
endfunction
//===========================================================================
function INV_GetItemName takes integer itemId, boolean desc returns string
local integer i = 0
if desc then
return iif(HaveStoredString(udg_INV_cache, I2S(itemId), "desc"), GetStoredString(udg_INV_cache, I2S(itemId), "desc"), "read how to add your own custom items in the \"init item settings\" section of the map")
endif
return iif(HaveStoredString(udg_INV_cache, I2S(itemId), "name"), GetStoredString(udg_INV_cache, I2S(itemId), "name"), "Unknown Item ("+ItemID2String(itemId)+")")
endfunction
//===========================================================================
function INV_GetItemIcon takes integer itemId returns string
local integer i = 0
return iif(HaveStoredString(udg_INV_cache, I2S(itemId), "icon"), GetStoredString(udg_INV_cache, I2S(itemId), "icon"), "BTNSelectHeroOn")
endfunction
//===========================================================================
function INV_GetItemCost takes integer itemId returns integer
local integer i = 0
if HaveStoredInteger(udg_INV_cache, I2S(itemId), "cost") then
return R2I(GetStoredInteger(udg_INV_cache, I2S(itemId), "cost") * udg_INV_sell_rate)
endif
return 0
endfunction
//===========================================================================
function cp_INV_RefreshTextTags takes nothing returns nothing
local integer tid = cp_GetHoveredTrackable()
local integer g = cp_GetTrackableGroup(tid)
local integer gid = cp_GetTrackableGroupID(tid)
local integer tmp
local integer x
local integer y
local integer i = 0
// ###### item charge counts ######
loop
exitwhen i >= udg_INV_cols * udg_INV_rows
set x = ModuloInteger(i,udg_INV_cols) + udg_INV_Data[1]
set y = i/udg_INV_cols + udg_INV_Data[2]
call cp_GetTrackableLocation(20*y + x)
set tmp = GetItemCharges(udg_INV_item[i])
call cp_DrawText(20+i,GetLocationX(udg_cp_TrackableLoc)+1.65*x,GetLocationY(udg_cp_TrackableLoc)-31-2*y, 0.017, iif(tmp > 0, I2S(tmp), " "))
set i = i + 1
endloop
set i = 0
loop
exitwhen i >= 6
set x = ModuloInteger(i,2) + 2
set y = i/2 + 2
call cp_GetTrackableLocation(cp_GetTrackableIDByGroup(0, i))
set tmp = GetItemCharges(UnitItemInSlot(udg_INV_unit,i))
call cp_DrawText(10+i,GetLocationX(udg_cp_TrackableLoc)+1.65*x,GetLocationY(udg_cp_TrackableLoc)-31-2*y, 0.017, iif(tmp > 0, I2S(tmp), " "))
set i = i + 1
endloop
// ###### "click on slot" message ######
if cp_SelectedCell() >= 0 then
set g = cp_GetTrackableGroup(cp_SelectedCell())
set gid = cp_GetTrackableGroupID(cp_SelectedCell())
endif
call cp_DrawText(6,udg_cp_BaseX+150, udg_cp_BaseY+220, 0.018, iif(cp_SelectedCell() >= 0, "|c00ff0000Click on empty slot to move that item.|r", " "))
// ###### tooltips & item info ######
call cp_DrawText(4,udg_cp_BaseX+150,udg_cp_BaseY+400,0," ")
call cp_DrawText(5,udg_cp_BaseX+150,udg_cp_BaseY+280,0," ")
call cp_DrawText(7,udg_cp_BaseX+1290,udg_cp_BaseY+24,0," ")
call cp_DrawText(8,udg_cp_BaseX+650,udg_cp_BaseY+450,0," ")
endfunction
//===========================================================================
function INV_UseItem takes nothing returns nothing
local integer tid = udg_INV_Data[3]
local integer charges = udg_INV_Data[4]
local integer g = cp_GetTrackableGroup(tid)
local integer slot = cp_GetTrackableGroupID(tid)
local item selecteditem
call DestroyTrigger(GetTriggeringTrigger())
call PauseUnit(udg_INV_unit, true)
if g == 1 then
set selecteditem = udg_INV_item[slot]
call UnitRemoveItem(udg_INV_unit, selecteditem)
call SetItemPosition(selecteditem, udg_cp_BaseX-100, udg_cp_BaseY-100)
call UnitAddItem(udg_INV_unit, udg_INV_item[99])
set udg_INV_item[99] = null
else
set selecteditem = UnitItemInSlot(udg_INV_unit, slot)
endif
if charges != 0 and GetItemCharges(selecteditem) != charges then
// ###### operation succeeded ######
call PlaySound("Abilities\\Spells\\Items\\AIam\\Tomes.wav")
call cp_UpdateText(4,0,0,0," ")
call cp_UpdateText(5,0,0,0," ")
call cp_UpdateText(6,0,0,0," ")
call cp_UpdateText(7,0,0,0," ")
call cp_UpdateText(8,0,0,0," ")
call cp_CreateEffect(200, "DISBTNDrop.mdx", 20*9+10)
call cp_CreateEffect(203, "DISBTNUse.mdx", 20*9+9)
if udg_INV_Data[0] == 1 then
call cp_CreateEffect(201, "DISBTNSell.mdx", 20*9+8)
endif
call cp_CreateEffect(202, "",0)
call cp_SelectCell(-1, "")
if charges == 1 then
// ###### last charge was used ######
if g == 1 then
set udg_INV_item[slot] = null
endif
call cp_CreateEffect(210+10*g+slot, "", 0)
call cp_UpdateText(10+10*g+slot, 0, 0, 0, " ")
call cp_CreateEffect(tid, "empinv" + INV_GetSkin() + ".mdx", tid)
else
call cp_UpdateText(10+10*g+slot, 0, 0, 0.017, I2S(GetItemCharges(selecteditem)))
endif
else
// ###### couldn't use that item... ######
call PlaySound("Sound\\Interface\\Error.wav")
call cp_UpdateText(6,0,0,0.018,"|c00ff0000Can't use that item.|r")
endif
endfunction
//===========================================================================
function cp_INV_ClickHandler takes nothing returns nothing
local integer tid = cp_GetClickedTrackable()
local integer g = cp_GetTrackableGroup(tid)
local integer slot = cp_GetTrackableGroupID(tid)
local integer tid2 = cp_SelectedCell()
local integer g2 = cp_GetTrackableGroup(tid2)
local integer slot2 = cp_GetTrackableGroupID(tid2)
local item selecteditem
local item newitem
local trigger t
if g == 0 then
set newitem = UnitItemInSlot(udg_INV_unit,slot)
elseif g == 1 then
set newitem = udg_INV_item[slot]
else
set newitem = null
endif
if g2 == 0 then
set selecteditem = UnitItemInSlot(udg_INV_unit,slot2)
elseif g2 == 1 then
set selecteditem = udg_INV_item[slot2]
else
set selecteditem = null
endif
// ########## pickup button ###########
if g == 2 then
set udg_INV_add_mode = not udg_INV_add_mode
call cp_HighlightCell(tid, udg_INV_add_mode, "selector.mdx")
call PlaySound("Sound\\Interface\\AutoCastButtonClick1.wav")
call cp_UpdateText(7,0,0,0,"Pickup to Extended Inventory: |cffffcc00" + iif(udg_INV_add_mode, "ON","OFF") + "|r")
return
endif
// ########## exit button ###########
if g == 3 then
call cp_Enable(false)
return
endif
// ########## drop button ###########
if g == 4 then
if tid2 != -1 then
call PlaySound("Sound\\Interface\\BigButtonClick.wav")
call cp_UpdateText(4,0,0,0," ")
call cp_UpdateText(5,0,0,0," ")
call cp_UpdateText(6,0,0,0," ")
call cp_UpdateText(7,0,0,0," ")
call cp_UpdateText(8,0,0,0," ")
call cp_CreateEffect(200, "DISBTNDrop.mdx", 20*9+10)
call cp_CreateEffect(203, "DISBTNUse.mdx", 20*9+9)
if udg_INV_Data[0] == 1 then
call cp_CreateEffect(201, "DISBTNSell.mdx", 20*9+8)
endif
call cp_CreateEffect(202, "",0)
call cp_SelectCell(-1, "")
call cp_CreateEffect(tid2, "empinv" + INV_GetSkin() + ".mdx", tid2)
if g2 == 0 then
call UnitRemoveItemFromSlot(udg_INV_unit, slot2)
call cp_CreateEffect(210+slot2, "", 0)
call cp_UpdateText(10+slot2, 0, 0, 0, " ")
else
call SetItemPosition(udg_INV_item[slot2], GetUnitX(udg_INV_unit), GetUnitY(udg_INV_unit))
set udg_INV_item[slot2] = null
call cp_CreateEffect(220+slot2, "", 0)
call cp_UpdateText(20+slot2, 0, 0, 0, " ")
endif
endif
return
endif
// ########## use button ###########
if g == 6 then
if tid2 != -1 and GetItemCharges(selecteditem) > 0 and udg_INV_item[99] == null then
if g2 == 1 then
set udg_INV_item[99] = UnitItemInSlot(udg_INV_unit, 0)
call UnitRemoveItem(udg_INV_unit, udg_INV_item[99])
call UnitAddItem(udg_INV_unit, selecteditem)
endif
call PauseUnit(udg_INV_unit, false)
call UnitUseItem(udg_INV_unit, selecteditem)
// ### delayed launch handler func ###
set t = CreateTrigger()
call TriggerRegisterTimerEvent(t, 0.01, false)
call TriggerAddAction(t, function INV_UseItem)
// ### pass required stuff via globals ###
set udg_INV_Data[3] = tid2
set udg_INV_Data[4] = GetItemCharges(selecteditem)
endif
return
endif
// ########## sell button ###########
if g == 5 then
if tid2 != -1 and IsItemSellable(selecteditem) then
call PlaySound("Sound\\Interface\\ReceiveGold.wav")
call cp_UpdateText(4,0,0,0," ")
call cp_UpdateText(5,0,0,0," ")
call cp_UpdateText(6,0,0,0," ")
call cp_UpdateText(7,0,0,0," ")
call cp_UpdateText(8,0,0,0," ")
call cp_CreateEffect(200, "DISBTNDrop.mdx", 20*9+10)
call cp_CreateEffect(201, "DISBTNSell.mdx", 20*9+8)
call cp_CreateEffect(203, "DISBTNUse.mdx", 20*9+9)
call cp_CreateEffect(202, "",0)
call cp_SelectCell(-1, "")
call cp_CreateEffect(tid2, "empinv" + INV_GetSkin() + ".mdx", tid2)
if g2 == 0 then
call UnitRemoveItemFromSlot(udg_INV_unit, slot2)
call cp_CreateEffect(210+slot2, "", 0)
call cp_UpdateText(10+slot2, 0, 0, 0, " ")
else
set udg_INV_item[slot2] = null
call cp_CreateEffect(220+slot2, "", 0)
call cp_UpdateText(20+slot2, 0, 0, 0, " ")
endif
call SetPlayerState(GetLocalPlayer(), PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(GetLocalPlayer(), PLAYER_STATE_RESOURCE_GOLD) + INV_GetItemCost(GetItemTypeId(selecteditem)))
call RemoveItem(selecteditem)
endif
return
endif
// ########## the rest ###########
call cp_GetTrackableLocation(tid)
if newitem != null then
call PlaySound("Sound\\Interface\\MouseClick1.wav")
if selecteditem == newitem then
// ###### deselect ######
call cp_UpdateText(6,0,0,0," ")
call cp_SelectCell(-1, "")
call cp_CreateEffect(203, "DISBTNUse.mdx", 20*9+9)
call cp_CreateEffect(200, "DISBTNDrop.mdx", 20*9+10)
if udg_INV_Data[0] == 1 then
call cp_CreateEffect(201, "DISBTNSell.mdx", 20*9+8)
endif
return
endif
// ###### update selected item info ######
call cp_SelectCell(tid,"selecter" + INV_GetSkin() + ".mdx")
call cp_CreateEffect(200, "BTNDrop.mdx", 20*9+10)
if udg_INV_Data[0] == 1 then
call cp_CreateEffect(201, iif(IsItemSellable(newitem),"","DIS") + "BTNSell.mdx", 20*9+8)
endif
call cp_CreateEffect(203, iif(GetItemCharges(newitem) > 0,"","DIS") + "BTNUse.mdx", 20*9+9)
call cp_UpdateText(4,0,0,0.03,INV_GetItemName(GetItemTypeId(newitem),false))
call cp_UpdateText(5,0,0,0,"|c00ffcc00"+INV_GetItemName(GetItemTypeId(newitem),true)+"|r")
call cp_UpdateText(6,0,0,0.018,"|c00ff0000Click on empty slot to move that item.|r")
call cp_UpdateText(8,0,0,0.02, iif(IsItemSellable(newitem), "|c00ffcc00" + I2S(INV_GetItemCost(GetItemTypeId(newitem))) + "|r", " "))
call cp_CreateEffectXY(202, iif(IsItemSellable(newitem), "cost.mdx", ""), udg_cp_BaseX+642, udg_cp_BaseY+468)
return
endif
if selecteditem == null then
// ###### nothing -> ... :) ######
return
endif
call cp_CreateEffect(203, "DISBTNUse.mdx", 20*9+9)
call cp_CreateEffect(200, "DISBTNDrop.mdx", 20*9+10)
if udg_INV_Data[0] == 1 then
call cp_CreateEffect(201, "DISBTNSell.mdx", 20*9+8)
endif
if g == 0 then
if g2 == 0 then
// ###### small -> small ######
call UnitRemoveItem(udg_INV_unit, selecteditem)
call INV_UnitAddItemToSlot(udg_INV_unit, selecteditem, slot)
call cp_CreateEffect(210+slot2, "", 0)
call cp_UpdateText(10+slot2, 0, 0, 0, " ")
else
// ###### large -> small ######
call INV_UnitAddItemToSlot(udg_INV_unit, selecteditem, slot)
set udg_INV_item[slot2] = null
call cp_CreateEffect(220+slot2, "", 0)
call cp_UpdateText(20+slot2, 0, 0, 0, " ")
endif
else
if g2 == 0 then
// ###### small -> large ######
call UnitRemoveItem(udg_INV_unit, selecteditem)
set udg_INV_item[slot] = selecteditem
call SetItemPosition(selecteditem, udg_cp_BaseX-100, udg_cp_BaseY-100)
call cp_CreateEffect(210+slot2, "", 0)
call cp_UpdateText(10+slot2, 0, 0, 0, " ")
else
// ###### large -> large ######
set udg_INV_item[slot] = selecteditem
set udg_INV_item[slot2] = null
call cp_CreateEffect(220+slot2, "", 0)
call cp_UpdateText(20+slot2, 0, 0, 0, " ")
endif
endif
if GetItemCharges(selecteditem) > 0 then
call cp_CreateEffectXY(210+10*g+slot, "number.mdx", GetLocationX(cp_GetTrackableLocation(tid))+20, GetLocationY(cp_GetTrackableLocation(tid))-25)
call cp_UpdateText(10+10*g+slot, 0, 0, 0.017, I2S(GetItemCharges(selecteditem)))
endif
call PlaySound("Sound\\Interface\\BigButtonClick.wav")
call cp_UpdateText(6,0,0,0," ")
call cp_SelectCell(-1, "")
call cp_CreateEffect(tid2, "empinv" + INV_GetSkin() + ".mdx", tid2)
call cp_CreateEffect(tid, INV_GetItemIcon(GetItemTypeId(selecteditem)) + ".mdx", tid)
endfunction
//===========================================================================
function cp_INV_HoverHandler takes nothing returns nothing
local integer tid = cp_GetHoveredTrackable()
local integer g = cp_GetTrackableGroup(tid)
local integer slot = cp_GetTrackableGroupID(tid)
local item it = null
local integer itemid
local string str
call cp_GetTrackableLocation(tid)
if cp_SelectedCell() >= 0 then
set g = cp_GetTrackableGroup(cp_SelectedCell())
set slot = cp_GetTrackableGroupID(cp_SelectedCell())
endif
if g == 0 and GetItemTypeId(UnitItemInSlot(udg_INV_unit,slot)) != 0 then
set it = UnitItemInSlot(udg_INV_unit,slot)
elseif g == 1 and udg_INV_item[slot] != null then
set it = udg_INV_item[slot]
endif
set itemid = GetItemTypeId(it)
set g = cp_GetTrackableGroup(tid)
// ########## button labels ###########
if g == 2 then
set str = "Pickup to Extended Inventory: |cffffcc00" + iif(udg_INV_add_mode, "ON", "OFF") + "|r"
elseif g == 3 then
set str = "Return to Game (|cffffcc00ESC|r)|n|c00000000_|r"
elseif g == 4 then
set str = iif(cp_SelectedCell() != -1, "Drop Item|n|c00000000_|r", " ")
elseif g == 5 then
set str = iif(cp_SelectedCell() != -1 and IsItemSellable(it), "Sell Item|n|c00000000_|r", " ")
elseif g == 6 then
set str = iif(cp_SelectedCell() != -1 and GetItemCharges(it) > 0, "Use Item|n|c00000000_|r", " ")
else
set str = " "
endif
call cp_UpdateText(7,0,0,0,str)
// ########## hovered/selected item info ###########
if itemid == 0 then
call cp_UpdateText(4,0,0,0," ")
call cp_UpdateText(5,0,0,0," ")
call cp_UpdateText(8,0,0,0," ")
call cp_CreateEffect(202, "",0)
else
call cp_UpdateText(4,0,0,0.03,INV_GetItemName(itemid,false))
call cp_UpdateText(5,0,0,0,"|c00ffcc00"+INV_GetItemName(itemid,true)+"|r")
call cp_UpdateText(8,0,0,0.02, iif(IsItemIdSellable(itemid), "|c00ffcc00" + I2S(INV_GetItemCost(itemid)) + "|r", " "))
call cp_CreateEffectXY(202, iif(IsItemIdSellable(itemid), "cost.mdx", ""), udg_cp_BaseX+642, udg_cp_BaseY+468)
endif
endfunction
//===========================================================================
function cp_INV_Init2 takes nothing returns nothing
local integer i = udg_INV_Data[3]
local integer x
local integer y
local integer tid
// ############### large inv background ##############
set x = ModuloInteger(i,udg_INV_cols)
set y = i/udg_INV_cols
set tid = 20*(y + udg_INV_Data[2]) + udg_INV_Data[1] + x
call cp_CreateEffect(tid, iif(udg_INV_item[i] == null, "empinv" + INV_GetSkin(), INV_GetItemIcon(GetItemTypeId(udg_INV_item[i]))) + ".mdx", tid)
if GetItemCharges(udg_INV_item[i]) > 0 then
call cp_GetTrackableLocation(tid)
call cp_CreateEffectXY(220+i,"number.mdx",GetLocationX(udg_cp_TrackableLoc)+20,GetLocationY(udg_cp_TrackableLoc)-25)
endif
if x == 0 and y != 0 and y != (udg_INV_rows - 1) then
call cp_CreateBackgroundEffect("borderL"+INV_GetSkin()+".mdx", tid)
elseif x == udg_INV_cols - 1 and y != 0 and y != (udg_INV_rows - 1) then
call cp_CreateBackgroundEffect("borderR"+INV_GetSkin()+".mdx", tid)
elseif y == 0 and x != 0 and x != (udg_INV_cols - 1) then
call cp_CreateBackgroundEffect("borderU"+INV_GetSkin()+".mdx", tid)
elseif y == udg_INV_rows - 1 and x != 0 and x != (udg_INV_cols - 1) then
call cp_CreateBackgroundEffect("borderD"+INV_GetSkin()+".mdx", tid)
endif
call cp_CreateBackgroundEffect("central"+INV_GetSkin()+".mdx", tid)
set udg_INV_Data[3] = udg_INV_Data[3] + 1
if udg_INV_Data[3] >= udg_INV_rows * udg_INV_cols then
call DestroyTrigger(GetTriggeringTrigger())
endif
endfunction
//===========================================================================
function INV_DetectShop takes nothing returns nothing
if GetUnitAbilityLevel(GetEnumUnit(), 'Apit') == 1 then
set udg_INV_Data[0] = 1
endif
endfunction
//===========================================================================
function cp_INV_Init takes nothing returns nothing
local integer x
local integer y
local integer i = 0
local integer tid
local trigger t
local group gr = CreateGroup()
// ############### some data vars ################
// 0 - sell mode enabled (1/0)
// 1 - start x of large inv
// 2 - start y of large inv
// 3 - internal counter
// 4 - temporary
// detect nearby shop
set udg_INV_Data[0] = 0
call GroupEnumUnitsInRange(gr, GetUnitX(udg_INV_unit), GetUnitY(udg_INV_unit), udg_INV_sell_range, null)
call ForGroup(gr, function INV_DetectShop)
call DestroyGroup(gr)
set udg_INV_rows = IMinBJ(8, IMaxBJ(2, udg_INV_rows))
set udg_INV_cols = IMinBJ(10, IMaxBJ(2, udg_INV_cols))
set udg_INV_Data[1] = 8
if udg_INV_rows == 8 then
set udg_INV_rows = 8
set udg_INV_Data[2] = 0
else
set udg_INV_Data[2] = 1
endif
set udg_INV_Data[3] = 0
set y = udg_INV_Data[2]
// ############### trackable mapping ################
call cp_SetTrackableGroup(20*1+2,0)
call cp_SetTrackableGroup(20*1+3,0)
call cp_SetTrackableGroup(20*2+2,0)
call cp_SetTrackableGroup(20*2+3,0)
call cp_SetTrackableGroup(20*3+2,0)
call cp_SetTrackableGroup(20*3+3,0)
loop
exitwhen y >= udg_INV_Data[2] + udg_INV_rows
set x = udg_INV_Data[1]
loop
exitwhen x >= udg_INV_Data[1] + udg_INV_cols
call cp_SetTrackableGroup(20*y+x,1)
set x = x + 1
endloop
set y = y + 1
endloop
call cp_SetTrackableGroup(20*9+9,6)
call cp_SetTrackableGroup(20*9+10,4)
call cp_SetTrackableGroup(20*9+11,2)
call SelectUnit(udg_INV_unit, true)
call PauseUnit (udg_INV_unit, true)
// ############### small inv items ####################
loop
exitwhen i >= 6
set tid = 20*(i/2) + 22 + ModuloInteger(i,2)
if UnitItemInSlot(udg_INV_unit,i) != null then
call cp_CreateEffect(tid, INV_GetItemIcon(GetItemTypeId(UnitItemInSlot(udg_INV_unit,i))) + ".mdx", tid)
else
call cp_CreateEffect(tid, "empinv" + INV_GetSkin() + ".mdx", tid)
endif
call cp_CreateBackgroundEffect("central"+INV_GetSkin()+".mdx", tid)
if GetItemCharges(UnitItemInSlot(udg_INV_unit,i)) > 0 then
call cp_GetTrackableLocation(tid)
call cp_CreateEffectXY(210+i,"number.mdx",GetLocationX(udg_cp_TrackableLoc)+20,GetLocationY(udg_cp_TrackableLoc)-25)
endif
set i = i + 1
endloop
// ############### small inv background ##############
call cp_CreateBackgroundEffect("cornerUL"+INV_GetSkin()+".mdx", 20*1+2)
call cp_CreateBackgroundEffect("cornerUR"+INV_GetSkin()+".mdx", 20*1+3)
call cp_CreateBackgroundEffect("borderL"+INV_GetSkin()+".mdx", 20*2+2)
call cp_CreateBackgroundEffect("borderR"+INV_GetSkin()+".mdx", 20*2+3)
call cp_CreateBackgroundEffect("cornerDL"+INV_GetSkin()+".mdx", 20*3+2)
call cp_CreateBackgroundEffect("cornerDR"+INV_GetSkin()+".mdx", 20*3+3)
// ############### other background stuff ############
call cp_CreateBackgroundEffect("cornerUL"+INV_GetSkin()+".mdx", udg_INV_Data[1] + 20*udg_INV_Data[2])
call cp_CreateBackgroundEffect("cornerUR"+INV_GetSkin()+".mdx", udg_INV_Data[1] + 20*udg_INV_Data[2] + udg_INV_cols - 1)
call cp_CreateBackgroundEffect("cornerDL"+INV_GetSkin()+".mdx", udg_INV_Data[1] + 20*(udg_INV_rows-1 + udg_INV_Data[2]))
call cp_CreateBackgroundEffect("cornerDR"+INV_GetSkin()+".mdx", udg_INV_Data[1] + 20*(udg_INV_rows-1 + udg_INV_Data[2]) + udg_INV_cols - 1)
call cp_CreateBackgroundEffect("cornerUL"+INV_GetSkin()+".mdx", 20*5+1)
call cp_CreateBackgroundEffect("borderL"+INV_GetSkin()+".mdx", 20*6+1)
call cp_CreateBackgroundEffect("cornerDL"+INV_GetSkin()+".mdx", 20*7+1)
call cp_CreateBackgroundEffect("cornerUR"+INV_GetSkin()+".mdx", 20*5+6)
call cp_CreateBackgroundEffect("borderR"+INV_GetSkin()+".mdx", 20*6+6)
call cp_CreateBackgroundEffect("cornerDR"+INV_GetSkin()+".mdx", 20*7+6)
call cp_CreateBackgroundEffect("borderU"+INV_GetSkin()+".mdx", 20*5+2)
call cp_CreateBackgroundEffect("borderU"+INV_GetSkin()+".mdx", 20*5+3)
call cp_CreateBackgroundEffect("borderU"+INV_GetSkin()+".mdx", 20*5+4)
call cp_CreateBackgroundEffect("borderU"+INV_GetSkin()+".mdx", 20*5+5)
call cp_CreateBackgroundEffect("borderD"+INV_GetSkin()+".mdx", 20*7+2)
call cp_CreateBackgroundEffect("borderD"+INV_GetSkin()+".mdx", 20*7+3)
call cp_CreateBackgroundEffect("borderD"+INV_GetSkin()+".mdx", 20*7+4)
call cp_CreateBackgroundEffect("borderD"+INV_GetSkin()+".mdx", 20*7+5)
call cp_CreateBackgroundEffect("description"+INV_GetSkin()+".mdx", 20*6+4)
// ############## buttons ############
call cp_CreateEffect(203, "DISBTNUse.mdx", 20*9+9)
call cp_CreateEffect(200, "DISBTNDrop.mdx", 20*9+10)
call cp_CreateBackgroundEffect("BTNAutoPickup.mdx", 20*9+11)
call cp_HighlightCell(20*9+11, udg_INV_add_mode, "selector.mdx")
call cp_CreateBackgroundEffect("central"+INV_GetSkin()+".mdx", 20*9+8)
call cp_CreateBackgroundEffect("central"+INV_GetSkin()+".mdx", 20*9+9)
call cp_CreateBackgroundEffect("central"+INV_GetSkin()+".mdx", 20*9+10)
call cp_CreateBackgroundEffect("central"+INV_GetSkin()+".mdx", 20*9+11)
call cp_CreateBackgroundEffect("borderU"+INV_GetSkin()+".mdx", 20*9+9)
call cp_CreateBackgroundEffect("borderU"+INV_GetSkin()+".mdx", 20*9+10)
call cp_CreateBackgroundEffect("borderD"+INV_GetSkin()+".mdx", 20*9+9)
call cp_CreateBackgroundEffect("borderD"+INV_GetSkin()+".mdx", 20*9+10)
call cp_CreateBackgroundEffect("cornerDR"+INV_GetSkin()+".mdx",20*9+11)
call cp_CreateBackgroundEffect("cornerUR"+INV_GetSkin()+".mdx",20*9+11)
call cp_CreateEffect(201, "DISBTNSell.mdx", 20*9+8)
call cp_SetTrackableGroup(20*9+7,3)
if udg_INV_Data[0] == 1 then
call cp_SetTrackableGroup(20*9+8,5)
endif
call cp_CreateBackgroundEffect("borderU"+INV_GetSkin()+".mdx", 20*9+8)
call cp_CreateBackgroundEffect("borderD"+INV_GetSkin()+".mdx", 20*9+8)
call cp_CreateBackgroundEffect("cornerDL"+INV_GetSkin()+".mdx",20*9+7)
call cp_CreateBackgroundEffect("cornerUL"+INV_GetSkin()+".mdx",20*9+7)
call cp_CreateBackgroundEffect("central"+INV_GetSkin()+".mdx", 20*9+7)
call cp_CreateBackgroundEffect("BTNExit.mdx", 20*9+7)
// ############## launch second part ############
set t = CreateTrigger()
call TriggerAddAction(t, function cp_INV_Init2)
call TriggerRegisterTimerEvent(t, 0, true)
set udg_INV_item[99] = null
call PlaySound("Sound\\Interface\\RightGlueScreenPopDown.wav")
endfunction
//===========================================================================
function cp_INV_Exit takes nothing returns nothing
call PlaySound("Sound\\Interface\\RightGlueScreenPopUp.wav")
call PauseUnit(udg_INV_unit, false)
// ########### no special cleanup needed - all should be done by cp engine ################
return
endfunction
//===========================================================================
function INV_PickupHandler takes nothing returns nothing
local integer i = 0
if udg_cp_Enabled or not udg_INV_add_mode or IsItemPowerup(GetManipulatedItem()) then
return
endif
loop
exitwhen i > udg_INV_rows * udg_INV_cols or udg_INV_item[i] == null
set i = i + 1
endloop
if i == udg_INV_rows * udg_INV_cols then
return
endif
call UnitRemoveItem(udg_INV_unit, GetManipulatedItem())
set udg_INV_item[i] = GetManipulatedItem()
call SetItemPosition(GetManipulatedItem(), udg_cp_BaseX-100, udg_cp_BaseY-100)
endfunction
//===========================================================================
function INV_SaveToCache takes gamecache cache, string missionKey returns nothing
local integer i = 0
call StoreBoolean(cache, missionKey, "INV_add_mode", udg_INV_add_mode)
call StoreInteger(cache, missionKey, "INV_rows", udg_INV_rows)
call StoreInteger(cache, missionKey, "INV_cols", udg_INV_cols)
loop
exitwhen i >= udg_INV_rows * udg_INV_cols
call StoreInteger(cache, missionKey, "INV_item_"+I2S(i), GetItemTypeId(udg_INV_item[i]))
call StoreInteger(cache, missionKey, "INV_item_"+I2S(i)+"_charges", GetItemCharges(udg_INV_item[i]))
set i = i + 1
endloop
endfunction
//===========================================================================
function INV_LoadFromCache takes gamecache cache, string missionKey returns nothing
local integer i = 0
local item it
if not HaveStoredBoolean(cache, missionKey, "INV_add_mode") then
return
endif
set udg_INV_add_mode = GetStoredBoolean(cache, missionKey, "INV_add_mode")
set udg_INV_rows = GetStoredInteger(cache, missionKey, "INV_rows")
set udg_INV_cols = GetStoredInteger(cache, missionKey, "INV_cols")
loop
exitwhen i >= udg_INV_rows * udg_INV_cols
if GetStoredInteger(cache, missionKey, "INV_item_"+I2S(i)) != 0 then
set it = CreateItem(GetStoredInteger(cache, missionKey, "INV_item_"+I2S(i)), udg_cp_BaseX-100, udg_cp_BaseY-100)
call SetItemCharges(it, GetStoredInteger(cache, missionKey, "INV_item_"+I2S(i)+"_charges"))
set udg_INV_item[i] = it
endif
set i = i + 1
endloop
endfunction
//===========================================================================
function InitTrig_inventory_module takes nothing returns nothing
set gg_trg_inventory_module = null
endfunction
//===========================================================================
function INV_RegisterItem takes integer i, string name, string desc, integer cost, string icon returns nothing
call StoreString(udg_INV_cache, I2S(i), "name", name)
call StoreString(udg_INV_cache, I2S(i), "desc", desc)
call StoreString(udg_INV_cache, I2S(i), "icon", icon)
call StoreInteger(udg_INV_cache,I2S(i), "cost", cost)
endfunction
//===========================================================================
function InitTrig_inventory_init_item_settings takes nothing returns nothing
set gg_trg_inventory_init_item_settings = null
set udg_INV_cache = InitGameCache("inv80.w3v")
//===========================================================================
// place info for your custom items here...
// format: call INV_RegisterItem([Item Code], [Item Name], [Item Description], [Item Cost], [Item Icon])"
// e.g. : call INV_RegisterItem('I000', "My New Custom Item", "blah-blah-blah...", 666, "BTNMyItem")
//
// if you use any custom item icons, you should create mdx'es for them and import to the map
// you can use this script : http://www.xgm.ru/stuff/inv_mdx.php
//===========================================================================
// based on ItemStrings.txt, ItemFunc.txt & ItemData.slk v1.16 (274 items total)
call INV_RegisterItem('amrc',"Amulet of Recall","Can be used to teleport units to the user.", 250, "BTNAmulet")
call INV_RegisterItem('ankh',"Ankh of Reincarnation","Allows reincarnation upon death.", 800, "BTNAnkh")
call INV_RegisterItem('belv',"Boots of Quel'Thalas +6","Provides a bonus to Agility.", 500, "BTNBoots")
call INV_RegisterItem('bgst',"Belt of Giant Strength +6","Provides a bonus to Strength.", 500, "BTNBelt")
call INV_RegisterItem('bspd',"Boots of Speed","Increases movement rate.", 250, "BTNBootsOfSpeed")
call INV_RegisterItem('ccmd',"Scepter of Mastery","Allows mind control of non-Hero units.", 1000, "BTNScepterOfMastery")
call INV_RegisterItem('ciri',"Robe of the Magi +6","Provides a bonus to Intelligence.", 500, "BTNRobeOfTheMagi")
call INV_RegisterItem('ckng',"Crown of Kings +5","Provides a +5 bonus to Agility, Strength, and Intelligence.", 1000, "BTNHelmutPurple")
call INV_RegisterItem('clsd',"Cloak of Shadows","Provides the Shadowmeld ability.", 100, "BTNCloak")
call INV_RegisterItem('crys',"Crystal Ball","Permits the viewing of distant areas.", 500, "BTNCrystalBall")
call INV_RegisterItem('desc',"Kelen's Dagger of Escape","Teleports the Hero a short distance.", 400, "BTNDaggerOfEscape")
call INV_RegisterItem('flag',"Human Flag","Can be captured in special scenarios.", 1000, "BTNHumanCaptureFlag")
call INV_RegisterItem('nflg',"Night Elf Flag","Can be captured in special scenarios.", 1000, "BTNNightElfCaptureFlag")
call INV_RegisterItem('oflg',"Orc Flag","Can be captured in special scenarios.", 1000, "BTNOrcCaptureFlag")
call INV_RegisterItem('uflg',"Undead Flag","Can be captured in special scenarios.", 1000, "BTNUndeadCaptureFlag")
call INV_RegisterItem('gemt',"Gem of True Seeing","Permits invisible units to be seen.", 200, "BTNGem")
call INV_RegisterItem('gobm',"Goblin Land Mines","Explosive mines.", 225, "BTNGoblinLandMine")
call INV_RegisterItem('gsou',"Soul Gem","Allows the theft of a Hero's soul.", 1000, "BTNSoulGem")
call INV_RegisterItem('guvi',"Glyph of Ultravision","Improves night vision.", 125, "BTNGlyph")
call INV_RegisterItem('gfor',"Glyph of Fortification","Improves building armor and hit points.", 200, "BTNGlyph")
call INV_RegisterItem('soul',"Soul","This is a trapped soul.", 1000, "BTNUsedSoulGem")
call INV_RegisterItem('mdpb',"Medusa Pebble","Turns target unit to stone.", 200, "BTNPebble")
call INV_RegisterItem('rag1',"Slippers of Agility +3","Boosts Agility by 3.", 100, "BTNSlippersOfAgility")
call INV_RegisterItem('rat3',"Claws of Attack +3","Boosts attack damage by 3.", 50, "BTNClawsOfAttack")
call INV_RegisterItem('rin1',"Mantle of Intelligence +3","Boosts Intelligence by 3.", 100, "BTNMantleOfIntelligence")
call INV_RegisterItem('rde1',"Ring of Protection +2","Boosts armor by 2.", 150, "BTNRingGreen")
call INV_RegisterItem('rde2',"Ring of Protection +3","Boosts armor by 3.", 400, "BTNRingGreen")
call INV_RegisterItem('rde3',"Ring of Protection +4","Boosts armor by 4.", 500, "BTNRingGreen")
call INV_RegisterItem('rhth',"Khadgar's Gem of Health","Increases the hit points of the Hero.", 500, "BTNPeriapt1")
call INV_RegisterItem('rst1',"Gauntlets of Ogre Strength +3","Boosts Strength by 3.", 100, "BTNGauntletsOfOgrePower")
call INV_RegisterItem('ofir',"Orb of Fire","Attacks also do fire damage.", 275, "BTNOrbOfFire")
call INV_RegisterItem('ofro',"Orb of Frost","Attacks cause Frost Shock.", 800, "BTNOrbOfFrost")
call INV_RegisterItem('olig',"Orb of Lightning","Attacks cause lightning damage.", 450, "BTNOrbOfLightning")
call INV_RegisterItem('oli2',"Orb of Lightning","Attacks cause lightning damage.", 375, "BTNOrbOfLightning")
call INV_RegisterItem('oven',"Orb of Venom","Attacks cause poison damage.", 325, "BTNOrbOfVenom")
call INV_RegisterItem('odef',"Orb of Darkness","Attacks can create Dark Minions.", 500, "BTNOrbOfDarkness")
call INV_RegisterItem('ocor',"Orb of Corruption","Attacks reduce armor.", 375, "BTNOrbOfCorruption")
call INV_RegisterItem('pdiv',"Potion of Divinity","Turns Hero invulnerable.", 600, "BTNPotionOfDivinity")
call INV_RegisterItem('phea',"Potion of Healing","Restores lost hit points.", 150, "BTNPotionGreenSmall")
call INV_RegisterItem('pghe',"Potion of Greater Healing","Restores lost hit points.", 400, "BTNPotionGreen")
call INV_RegisterItem('pinv',"Potion of Invisibility","Renders Hero temporarily invisible.", 100, "BTNLesserInvisibility")
call INV_RegisterItem('pgin',"Potion of Greater Invisibility","Renders Hero temporarily invisible.", 200, "BTNGreaterInvisibility")
call INV_RegisterItem('pman',"Potion of Mana","Restores lost mana.", 200, "BTNPotionBlueSmall")
call INV_RegisterItem('pgma',"Potion of Greater Mana","Restores lost mana.", 400, "BTNPotionBlueBig")
call INV_RegisterItem('pnvu',"Potion of Invulnerability","Renders Hero temporarily invulnerable.", 400, "BTNGreaterInvulneralbility")
call INV_RegisterItem('pnvl',"Potion of Lesser Invulnerability","Renders Hero temporarily invulnerable.", 150, "BTNLesserInvulneralbility")
call INV_RegisterItem('pres',"Potion of Restoration","Restores lost hit points and mana.", 600, "BTNPotionOfRestoration")
call INV_RegisterItem('pspd',"Potion of Speed","Provides Hero with a temporary speed increase.", 75, "BTNPotionRed")
call INV_RegisterItem('rlif',"Ring of Regeneration","Provides regeneration.", 200, "BTNRingSkull")
call INV_RegisterItem('rwiz',"Sobi Mask","Increases mana regeneration rate.", 400, "BTNSobiMask")
call INV_RegisterItem('sfog',"Horn of the Clouds","Stops enemy towers from attacking.", 200, "BTNHornOfFog")
call INV_RegisterItem('rhe1',"Rune of Lesser Healing","Restores hit points to nearby units.", 100, "BTNRune")
call INV_RegisterItem('rhe2',"Rune of Healing","Restores hit points to nearby units.", 200, "BTNRune")
call INV_RegisterItem('rhe3',"Rune of Greater Healing","Restores hit points to nearby units.", 300, "BTNRune")
call INV_RegisterItem('shea',"Scroll of Healing","Restores hit points to nearby units.", 250, "BTNScrollOfTownPortal")
call INV_RegisterItem('sman',"Scroll of Mana","Restores mana to nearby units.", 150, "BTNScrollOfProtection")
call INV_RegisterItem('rman',"Rune of Mana","Restores mana to nearby units.", 100, "BTNRune")
call INV_RegisterItem('rma2',"Rune of Greater Mana","Restores mana to nearby units.", 300, "BTNRune")
call INV_RegisterItem('spro',"Scroll of Protection","Temporarily increases the armor of nearby units.", 150, "BTNScroll")
call INV_RegisterItem('sres',"Scroll of Restoration","Restores hit points and mana to nearby units.", 750, "BTNScrollOfHealing")
call INV_RegisterItem('rres',"Rune of Restoration","Restores hit points and mana to nearby units.", 250, "BTNRune")
call INV_RegisterItem('ssil',"Staff of Silence","Stops enemy spellcasting.", 500, "BTNStaffOfSilence")
call INV_RegisterItem('stwp',"Scroll of Town Portal","Transports troops to friendly town hall.", 350, "BTNScrollUber")
call INV_RegisterItem('tels',"Goblin Night Scope","Increases sight range at night.", 200, "BTNTelescope")
call INV_RegisterItem('tdex',"Tome of Agility","Permanently increases Agility.", 150, "BTNTome")
call INV_RegisterItem('texp',"Tome of Experience","Gives bonus experience points.", 500, "BTNTomeBrown")
call INV_RegisterItem('tint',"Tome of Intelligence","Permanently increases Intelligence.", 150, "BTNTome")
call INV_RegisterItem('tkno',"Tome of Power","Gives the Hero an experience level.", 1250, "BTNTomeRed")
call INV_RegisterItem('tstr',"Tome of Strength","Permanently increases Strength.", 150, "BTNTome")
call INV_RegisterItem('ward',"Warsong Battle Drums","Increases combat effectiveness of nearby units.", 500, "BTNDrum")
call INV_RegisterItem('will',"Wand of Illusion","Creates a phantom double.", 150, "BTNWand")
call INV_RegisterItem('wneg',"Wand of Negation","Dispels magic in an area.", 200, "BTNWandSkull")
call INV_RegisterItem('rdis',"Rune of Dispel Magic","Dispels magic in the surrounding area.", 75, "BTNRune")
call INV_RegisterItem('rwat',"Rune of the Watcher","Creates an invulnerable Sentry Ward here.", 75, "BTNRune")
call INV_RegisterItem('fgrd',"Red Drake Egg","Summons a Red Drake.", 450, "BTNRedDragon")
call INV_RegisterItem('fgrg',"Stone Token","Summons a Rock Golem.", 450, "BTNRockGolem")
call INV_RegisterItem('fgdg',"Demonic Figurine","Summons a Doom Guard.", 750, "BTNDoomGuard")
call INV_RegisterItem('fgfh',"Spiked Collar","Summons a Fel Stalker.", 450, "BTNFelHound")
call INV_RegisterItem('fgsk',"Book of the Dead","Summons skeletons.", 450, "BTNBookOfTheDead")
call INV_RegisterItem('ktrm',"Urn of King Terenas","This urn contains the remains of King Terenas.", 200, "BTNUrnOfKelThuzad")
call INV_RegisterItem('sehr',"The Heart of Searinox","The heart of the Dragon Searinox.", 200, "BTNHeartOfSearinox")
call INV_RegisterItem('azhr',"Heart of Aszune","The magical amulet Heart of Aszune.", 200, "BTNHeartOfAszune")
call INV_RegisterItem('bzbe',"Empty Vial","This is an empty vial.", 200, "BTNVialEmpty")
call INV_RegisterItem('bzbf',"Full Vial","This vial is full of healing waters.", 200, "BTNVialFull")
call INV_RegisterItem('cnhn',"Horn of Cenarius","This is the Horn of Cenarius.", 200, "BTNHornOfCenarius")
call INV_RegisterItem('glsk',"Skull of Gul'dan","This is the Skull of Gul'dan.", 200, "BTNGuldanSkull")
call INV_RegisterItem('engs',"Enchanted Gemstone","This is an enchanted gemstone.", 200, "BTNEnchantedGemstone")
call INV_RegisterItem('k3m1',"Mooncrystal","This is one part of the Key of Three Moons.", 200, "BTN3M1")
call INV_RegisterItem('k3m2',"Partial Key of the Three Moons","This is two parts of the Key of Three Moons.", 200, "BTN3M2")
call INV_RegisterItem('k3m3',"Key of Three Moons","This is the complete Key of Three Moons.", 200, "BTN3M3")
call INV_RegisterItem('modt',"Mask of Death","This mask causes the Hero's attacks to drain life.", 1000, "BTNMaskOfDeath")
call INV_RegisterItem('sand',"Scroll of Animate Dead","Animates the dead to fight for you.", 750, "BTNSnazzyScrollPurple")
call INV_RegisterItem('srrc',"Scroll of Resurrection","Resurrects your dead to fight again.", 750, "BTNSnazzyScroll")
call INV_RegisterItem('rre1',"Rune of Lesser Resurrection","Resurrects your dead to fight again.", 100, "BTNRune")
call INV_RegisterItem('rre2',"Rune of Greater Resurrection","Resurrects your dead to fight again.", 300, "BTNRune")
call INV_RegisterItem('rspl',"Rune of Spirit Link","Links units together to distribute damage.", 150, "BTNRune")
call INV_RegisterItem('sror',"Scroll of the Beast","Boosts friendly unit combat damage.", 400, "BTNSnazzyScrollGreen")
call INV_RegisterItem('infs',"Inferno Stone","Brings down an Infernal Demon.", 750, "BTNInfernalStone")
call INV_RegisterItem('shar',"Ice Shard","Summons an Ice Revenant.", 750, "BTNIceShard")
call INV_RegisterItem('wild',"Amulet of the Wild","Summons a Furbolg.", 750, "BTNAmuletOftheWild")
call INV_RegisterItem('wswd',"Sentry Wards","Conjures a Sentry Ward.", 150, "BTNSentryWard")
call INV_RegisterItem('whwd',"Healing Wards","Conjures a Healing Ward.", 600, "BTNHealingWard")
call INV_RegisterItem('wlsd',"Wand of Lightning Shield","Casts Lightning Shield.", 150, "BTNStarWand")
call INV_RegisterItem('wcyc',"Wand of the Wind","Casts Cyclone.", 450, "BTNWandOfCyclone")
call INV_RegisterItem('rnec',"Rod of Necromancy","Creates two Skeleton Warriors from a corpse.", 150, "BTNRodOfNecromancy")
call INV_RegisterItem('pams',"Anti-magic Potion","Renders Hero immune to magic.", 100, "BTNSnazzyPotion")
call INV_RegisterItem('clfm',"Cloak of Flames","Surrounds the Hero with damaging flames.", 600, "BTNCloakOfFlames")
call INV_RegisterItem('evtl',"Talisman of Evasion","Makes the Hero harder to hit.", 400, "BTNTalisman")
call INV_RegisterItem('nspi',"Necklace of Spell Immunity","Grants immunity to magic.", 1000, "BTNNecklace")
call INV_RegisterItem('lhst',"The Lion Horn of Stormwind","Generates a protective aura around the Hero.", 400, "BTNLionHorn")
call INV_RegisterItem('kpin',"Khadgar's Pipe of Insight","Nearby units regain mana more swiftly.", 500, "BTNPipeOfInsight")
call INV_RegisterItem('sbch',"Scourge Bone Chimes","Nearby units gain some life from damage they deal to enemy units.", 450, "BTNBoneChimes")
call INV_RegisterItem('afac',"Alleria's Flute of Accuracy","Nearby units' missile attacks do more damage.", 400, "BTNAlleriaFlute")
call INV_RegisterItem('ajen',"Ancient Janggo of Endurance","Nearby units move and attack more swiftly.", 500, "BTNJanggo")
call INV_RegisterItem('lgdh',"Legion Doom-Horn","Nearby units heal and move more swiftly.", 400, "BTNHornOfDoom")
call INV_RegisterItem('hcun',"Hood of Cunning","Provides bonuses to Agility and Intelligence.", 500, "BTNHoodOfCunning")
call INV_RegisterItem('mcou',"Medallion of Courage","Provides bonuses to Strength and Intelligence.", 500, "BTNMedalionOfCourage")
call INV_RegisterItem('hval',"Helm of Valor","Provides bonuses to Strength and Agility.", 500, "BTNHelmOfValor")
call INV_RegisterItem('cnob',"Circlet of Nobility","Provides a +2 bonus to Strength, Agility and Intelligence.", 175, "BTNCirclet")
call INV_RegisterItem('prvt',"Periapt of Vitality","Increases the hit points of the Hero.", 350, "BTNPeriapt")
call INV_RegisterItem('tgxp',"Tome of Greater Experience","Gives bonus experience points.", 1000, "BTNManual3")
call INV_RegisterItem('mnst',"Mana Stone","Provides faster mana regeneration, and can be consumed for mana.", 450, "BTNManaStone")
call INV_RegisterItem('hlst',"Health Stone","Provides faster regeneration, and can be consumed for hit points.", 450, "BTNHealthStone")
call INV_RegisterItem('tpow',"Tome of Knowledge","Permanently increases Strength, Agility and Intelligence.", 300, "BTNTomeRed")
call INV_RegisterItem('tst2',"Tome of Strength +2","Permanently increases Strength.", 300, "BTNTome")
call INV_RegisterItem('tin2',"Tome of Intelligence +2","Permanently increases Intelligence.", 300, "BTNTome")
call INV_RegisterItem('tdx2',"Tome of Agility +2","Permanently increases Agility.", 300, "BTNTome")
call INV_RegisterItem('rde0',"Ring of Protection +1","Boosts armor by 1.", 50, "BTNRingGreen")
call INV_RegisterItem('rde4',"Ring of Protection +5","Boosts armor by 5.", 800, "BTNRingGreen")
call INV_RegisterItem('rat6',"Claws of Attack +6","Boosts attack damage by 6.", 100, "BTNClawsOfAttack")
call INV_RegisterItem('rat9',"Claws of Attack +9","Boosts attack damage by 9.", 400, "BTNClawsOfAttack")
call INV_RegisterItem('ratc',"Claws of Attack +12","Boosts attack damage by 12.", 500, "BTNClawsOfAttack")
call INV_RegisterItem('ratf',"Claws of Attack +15","Boosts attack damage by 15.", 800, "BTNClawsOfAttack")
call INV_RegisterItem('manh',"Manual of Health","Permanent +50 hit points.", 200, "BTNManual")
call INV_RegisterItem('pmna',"Pendant of Mana","Provides additional mana.", 500, "BTNPendantOfMana")
call INV_RegisterItem('penr',"Pendant of Energy","Provides additional mana.", 400, "BTNPendantOfEnergy")
call INV_RegisterItem('gcel',"Gloves of Haste","Increases attack speed.", 100, "BTNGlove")
call INV_RegisterItem('ledg',"Gerard's Lost Ledger","A ledger.", 200, "BTNSorceressMaster")
call INV_RegisterItem('totw',"Talisman of the Wild","Summons Furbolgs.", 450, "BTNStone")
call INV_RegisterItem('kybl',"Blood Key","A bloody key.", 200, "BTNBloodKey")
call INV_RegisterItem('kygh',"Ghost Key","A ghostly key.", 200, "BTNGhostKey")
call INV_RegisterItem('kysn',"Sun Key","A glowing key.", 200, "BTNSunKey")
call INV_RegisterItem('kymn',"Moon Key","A faintly glowing key.", 200, "BTNMoonKey")
call INV_RegisterItem('phlt',"Phat Lewt","The phattest lewt, definitely.", 500, "BTNUndeadShrine")
call INV_RegisterItem('gopr',"Glyph of Purification","A glyph.", 250, "BTNGlyph")
call INV_RegisterItem('ches',"Cheese","It's the Cheese!", 250, "BTNCheese")
call INV_RegisterItem('mlst',"Maul of Strength","Boosts Strength by 1.", 50, "BTNHammer")
call INV_RegisterItem('rnsp',"Ring of Superiority","Provides a +1 bonus to Strength, Agility and Intelligence.", 100, "BTNGoldRing")
call INV_RegisterItem('brag',"Bracer of Agility","Boosts Agility by 1.", 50, "BTNRingPurple")
call INV_RegisterItem('sksh',"Skull Shield","Boosts Strength by 1.", 200, "BTNGrimWard")
call INV_RegisterItem('vddl',"Voodoo Doll","Boosts Intelligence by 1.", 50, "BTNShadowPact")
call INV_RegisterItem('sprn',"Spider Ring","Boosts Agility by 1.", 50, "BTNRingVioletSpider")
call INV_RegisterItem('tmmt',"Totem of Might","Boosts Strength by 1.", 50, "BTNEntrapmentWard")
call INV_RegisterItem('anfg',"Ancient Figurine","Boosts Intelligence by 1.", 150, "BTNClayFigurine")
call INV_RegisterItem('lnrn',"Lion's Ring","Boosts Agility by 1.", 50, "BTNRingLionHead")
call INV_RegisterItem('iwbr',"Ironwood Branch","Boosts Strength by 1.", 50, "BTNNatureTouchGrow")
call INV_RegisterItem('jdrn',"Jade Ring","Boosts Agility by 1.", 50, "BTNRingJadeFalcon")
call INV_RegisterItem('drph',"Druid Pouch","Boosts Intelligence by 1.", 50, "BTNDust")
call INV_RegisterItem('hslv',"Healing Salve","Regenerates lost hit points over time.", 100, "BTNHealingSalve")
call INV_RegisterItem('pclr',"Clarity Potion","Regenerates mana over time.", 160, "BTNPotionOfClarity")
call INV_RegisterItem('plcl',"Lesser Clarity Potion","Regenerates mana over time.", 70, "BTNLesserClarityPotion")
call INV_RegisterItem('rej1',"Minor Replenishment Potion","Regenerates health and mana.", 100, "BTNMinorRejuvPotion")
call INV_RegisterItem('rej2',"Lesser Replenishment Potion","Regenerates health and mana.", 150, "BTNLesserRejuvPotion")
call INV_RegisterItem('rej3',"Replenishment Potion","Regenerates health and mana.", 150, "BTNRejuvPotion")
call INV_RegisterItem('rej4',"Greater Replenishment Potion","Regenerates health and mana.", 450, "BTNGreaterRejuvPotion")
call INV_RegisterItem('rej5',"Lesser Scroll of Replenishment ","Regenerates the health and mana of nearby units.", 400, "BTNLesserRejuvScroll")
call INV_RegisterItem('rej6',"Greater Scroll of Replenishment ","Regenerates the health and mana of nearby units.", 500, "BTNGreaterRejuvScroll")
call INV_RegisterItem('sreg',"Scroll of Regeneration","Regenerates the health of nearby units.", 100, "BTNScrollOfRegenerationGreen")
call INV_RegisterItem('gold',"Gold Coins","Gives gold to player.", 150, "BTNChestOfGold")
call INV_RegisterItem('lmbr',"Bundle of Lumber","Gives lumber to player.", 150, "BTNBundleOfLumber")
call INV_RegisterItem('fgun',"Flare Gun","Reveals an area on the map.", 125, "BTNFlare")
call INV_RegisterItem('pomn',"Potion of Omniscience","Reveals the entire map.", 400, "BTNPotionOfOmniscience")
call INV_RegisterItem('gomn',"Glyph of Omniscience","Reveals the entire map.", 300, "BTNGlyph")
call INV_RegisterItem('wneu',"Wand of Neutralization","Dispels magical effects in a chain.", 150, "BTNWandOfNeutralization")
call INV_RegisterItem('silk',"Spider Silk Broach","Webs a target air unit.", 50, "BTNSpiderSilkBroach")
call INV_RegisterItem('lure',"Monster Lure","Draws nearby creeps to ward.", 200, "BTNMonsterLure")
call INV_RegisterItem('skul',"Sacrificial Skull","Creates Blight at a target location.", 50, "BTNSacrificialSkull")
call INV_RegisterItem('moon',"Moonstone","Makes it night time.", 50, "BTNMoonStone")
call INV_RegisterItem('brac',"Runed Bracers","Reduces Magic damage to Hero.", 400, "BTNRunedBracers")
call INV_RegisterItem('vamp',"Vampiric Potion","Damage bonus and life-stealing attack.", 75, "BTNPotionOfVampirism")
call INV_RegisterItem('woms',"Wand of Mana Stealing","Steals mana.", 400, "BTNWandOfManaSteal")
call INV_RegisterItem('tcas',"Tiny Castle","Creates a Castle.", 800, "BTNTinyCastle")
call INV_RegisterItem('tgrh',"Tiny Great Hall","Creates a Great Hall.", 600, "BTNGreathall")
call INV_RegisterItem('tsct',"Ivory Tower","Creates a Scout Tower.", 30, "BTNHumanWatchTower")
call INV_RegisterItem('wshs',"Wand of Shadowsight","Grants vision of a target unit.", 150, "BTNWandOfShadowSight")
call INV_RegisterItem('tret',"Tome of Retraining","Unlearns a Hero's skills.", 300, "BTNTomeOfRetraining")
call INV_RegisterItem('sneg',"Staff of Negation","Dispels magic in an area.", 200, "BTNStaffOfNegation")
call INV_RegisterItem('stel',"Staff of Teleportation","Teleports the Hero.", 100, "BTNStaffOfTeleportation")
call INV_RegisterItem('spre',"Staff of Preservation","Teleports a target unit home.", 150, "BTNStaffOfPreservation")
call INV_RegisterItem('mcri',"Mechanical Critter","Creates a mechanical critter.", 50, "BTNMechanicalCritter")
call INV_RegisterItem('spsh',"Amulet of Spell Shield","Blocks enemy spells.", 400, "BTNSpellShieldAmulet")
call INV_RegisterItem('rsps',"Rune of Shielding","Gives nearby units a shield that blocks an enemy spell.", 300, "BTNRune")
call INV_RegisterItem('sbok',"Spell Book","A book full of random spells.", 325, "BTNSpellBookBLS")
call INV_RegisterItem('ssan',"Staff of Sanctuary","Heals and teleports a unit.", 250, "BTNStaffOfSanctuary")
call INV_RegisterItem('shas',"Scroll of Speed","Increases movement speed of units.", 50, "BTNScrollOfHaste")
call INV_RegisterItem('rspd',"Rune of Speed","Increases movement speed of units.", 200, "BTNRune")
call INV_RegisterItem('dust',"Dust of Appearance","Reveals invisible units.", 75, "BTNDustOfAppearance")
call INV_RegisterItem('oslo',"Orb of Slow","Attacks can slow enemies.", 550, "BTNOrbofSlowness")
call INV_RegisterItem('rreb',"Rune of Rebirth","Makes a monster yours.", 250, "BTNRune")
call INV_RegisterItem('dsum',"Diamond of Summoning","Summons your units to your Hero.", 400, "BTNDarkSummoning")
call INV_RegisterItem('sor1',"Shadow Orb +1","Gul'dan's Shadow Orb.", 50, "BTNOrbOfDarkness")
call INV_RegisterItem('sor2',"Shadow Orb +2","Gul'dan's Shadow Orb.", 100, "BTNOrbOfDarkness")
call INV_RegisterItem('sor3',"Shadow Orb +3","Gul'dan's Shadow Orb.", 200, "BTNOrbOfDarkness")
call INV_RegisterItem('sor4',"Shadow Orb +4","Gul'dan's Shadow Orb.", 300, "BTNOrbOfDarkness")
call INV_RegisterItem('sor5',"Shadow Orb +5","Gul'dan's Shadow Orb.", 350, "BTNOrbOfDarkness")
call INV_RegisterItem('sor6',"Shadow Orb +6","Gul'dan's Shadow Orb.", 400, "BTNOrbOfDarkness")
call INV_RegisterItem('sor7',"Shadow Orb +7","Gul'dan's Shadow Orb.", 550, "BTNOrbOfDarkness")
call INV_RegisterItem('sor8',"Shadow Orb +8","Gul'dan's Shadow Orb.", 700, "BTNOrbOfDarkness")
call INV_RegisterItem('sor9',"Shadow Orb +9","Gul'dan's Shadow Orb.", 900, "BTNOrbOfDarkness")
call INV_RegisterItem('sora',"Shadow Orb +10","Gul'dan's Shadow Orb.", 1250, "BTNOrbOfDarkness")
call INV_RegisterItem('sorf',"Shadow Orb Fragment","A fragment of the Shadow Orb.", 200, "BTNOrbOfDarkness")
call INV_RegisterItem('fwss',"Frost Wyrm Skull Shield","A powerful Undead artifact.", 750, "BTNGrimWard")
call INV_RegisterItem('gmfr',"Gem Fragment","A Gem Fragment from a powerful ring.", 200, "BTNGem")
call INV_RegisterItem('ram1',"Ring of the Archmagi","A powerful artifact with a shattered gem.", 125, "BTNRingJadeFalcon")
call INV_RegisterItem('ram2',"Ring of the Archmagi","A powerful artifact with a fragmented gem.", 300, "BTNRingJadeFalcon")
call INV_RegisterItem('ram3',"Ring of the Archmagi","A powerful artifact with a nearly intact gem.", 550, "BTNRingJadeFalcon")
call INV_RegisterItem('ram4',"Ring of the Archmagi","A powerful artifact with a wondrous gem.", 750, "BTNRingJadeFalcon")
call INV_RegisterItem('shtm',"Shamanic Totem","A powerful Orcish artifact.", 600, "BTNEntrapmentWard")
call INV_RegisterItem('esaz',"Essence of Aszune","A powerful Night Elf artifact.", 600, "BTNHeartOfAszune")
call INV_RegisterItem('jpnt',"Note to Jaina Proudmoore","A note to Jaina Proudmoore.", 200, "BTNScrollOfProtection")
call INV_RegisterItem('shwd',"Shimmerweed","A shimmering plant.", 200, "BTNShimmerWeed")
call INV_RegisterItem('btst',"Battle Standard","Thrall's Battle Standard.", 1000, "BTNOrcBattleStandard")
call INV_RegisterItem('skrt',"Skeletal Artifact","Soulfeast the Devourer.", 250, "BTNOrbOfCorruption")
call INV_RegisterItem('thle',"Thunder Lizard Egg","Massive Lizard Egg.", 200, "BTNThunderLizardEgg")
call INV_RegisterItem('sclp',"Secret Level Powerup","Unlocks a secret level!", 75, "BTNSelectHeroOn")
call INV_RegisterItem('gldo',"Orb of Kil'jaeden","Attacks also do fire damage.", 450, "BTNUsedSoulGem")
call INV_RegisterItem('wtlg',"Wirt's Leg","The One Leg.", 200, "BTNWirtsLeg")
call INV_RegisterItem('wolg',"Wirt's Other Leg","The One Other Leg.", 200, "BTNWirtsOtherLeg")
call INV_RegisterItem('tbsm',"Tiny Blacksmith","Creates a Blacksmith.", 200, "BTNBlacksmith")
call INV_RegisterItem('tfar',"Tiny Farm","Creates a Farm.", 75, "BTNFarm")
call INV_RegisterItem('tlum',"Tiny Lumber Mill","Creates a Lumber Mill.", 150, "BTNHumanLumberMill")
call INV_RegisterItem('tbar',"Tiny Barracks","Creates a Barracks.", 160, "BTNHumanBarracks")
call INV_RegisterItem('tbak',"Tiny Altar of Kings","Creates a Altar of Kings.", 180, "BTNAltarOfKings")
call INV_RegisterItem('mgtk',"Magic Key Chain","A key chain.", 200, "BTNBlood&GhostKey")
call INV_RegisterItem('stre',"Staff of Reanimation","Animates a corpse.", 200, "BTNWandSkull")
call INV_RegisterItem('horl',"Sacred Relic","A sacred shaman artifact.", 950, "BTNGlyph")
call INV_RegisterItem('hbth',"Helm of Battlethirst","|cff8b00ffUnique|r|nThis helm makes you crave combat.", 4200, "BTNUnholyAura")
call INV_RegisterItem('blba',"Bladebane Armor","Increases armor.", 3500, "BTNArmorGolem")
call INV_RegisterItem('rugt',"Runed Gauntlets","Increases strength and armor.", 725, "BTNImprovedUnholyStrength")
call INV_RegisterItem('frhg',"Firehand Gauntlets","Fiery gauntlets that increase armor and attack rate.", 3500, "BTNAdvancedUnholyStrength")
call INV_RegisterItem('gvsm',"Gloves of Spell Mastery","|cff8b00ffUnique|r|nThese gloves have a highly magical nature.", 1400, "BTNSpellSteal")
call INV_RegisterItem('crdt',"Crown of the Deathlord","|cffff8c00Artifact|r|nA simple crown with the emblem of an unfamiliar Paladin order on it.", 6400, "BTNRevenant")
call INV_RegisterItem('arsc',"Arcane Scroll","Restores hit points, mana and increases armor to nearby units.", 1000, "BTNBansheeAdept")
call INV_RegisterItem('scul',"Scroll of the Unholy Legion","Animates nearby corpses.", 950, "BTNBansheeMaster")
call INV_RegisterItem('tmsc',"Tome of Sacrifices","|cff8b00ffUnique|r|nAn evil looking tome with runes of necromancy etched into the binding.", 1250, "BTNNecromancerAdept")
call INV_RegisterItem('dtsb',"Drek'thar's Spellbook","|cffff8c00Artifact|r|nA seemingly simple spellbook, handed down from a master Farseer, Drek'thar.", 3350, "BTNSorceressMaster")
call INV_RegisterItem('grsl',"Grimoire of Souls","|cff87ceebUnique Consumable|r|nPermanently increases hit points.", 1350, "BTNNecromancerMaster")
call INV_RegisterItem('arsh',"Arcanite Shield","Increases armor and reduces damage from ranged attacks.", 3500, "BTNArcaniteArmor")
call INV_RegisterItem('shdt',"Shield of the Deathlord","|cffff8c00Artifact|r|nA magical shield with the emblem of an unfamiliar Paladin order on it.", 9000, "BTNLightningShield")
call INV_RegisterItem('shhn',"Shield of Honor","|cff8b00ffUnique|r|nA Kul Tiras navy commander's shield.", 3350, "BTNHumanArmorUpThree")
call INV_RegisterItem('shen',"Enchanted Shield","Increases armor and hit points.", 650, "BTNThoriumArmor")
call INV_RegisterItem('thdm',"Thunderlizard Diamond","|cff8b00ffUnique|r|nA massive diamond that crackles with electricity.", 1190, "BTNEnchantedGemstone")
call INV_RegisterItem('stpg',"Clockwork Penguin","A small clockwork penguin that squeaks.", 450, "BTNPenguin")
call INV_RegisterItem('shrs',"Shimmerglaze Roast","Restores lost hit points.", 150, "BTNMonsterLure")
call INV_RegisterItem('bfhr',"Bloodfeather's Heart","|cff8b00ffUnique|r|nThe heart of Bloodfeather.", 2500, "BTNPhilosophersStone")
call INV_RegisterItem('cosl',"Celestial Orb of Souls","|cffff8c00Artifact|r|nA bright glowing orb that instills peace.", 10000, "BTNUsedSoulGem")
call INV_RegisterItem('shcw',"Shaman Claws","|cff8b00ffUnique|r|nIncreases attack damage and dispels magic.", 950, "BTNShamanMaster")
call INV_RegisterItem('srbd',"Searing Blade","Increases attack damage.", 1650, "BTNArcaniteMelee")
call INV_RegisterItem('frgd',"Frostguard","Increases attack damage.", 1400, "BTNThoriumMelee")
call INV_RegisterItem('envl',"Enchanted Vial","Regenerates health and mana.", 450, "BTNVialFull")
call INV_RegisterItem('rump',"Rusty Mining Pick","Increases attack damage and gives a chance to stun.", 100, "BTNGatherGold")
call INV_RegisterItem('mort',"Mogrin's Report","A letter for Thrall.", 200, "BTNSpy")
call INV_RegisterItem('srtl',"Serathil","|cffff8c00Artifact|r|nThis massive axe is covered with notches and orcish runes.", 5500, "BTNOrcMeleeUpThree")
call INV_RegisterItem('stwa',"Sturdy War Axe","Increases attack damage.", 600, "BTNOrcMeleeUpOne")
call INV_RegisterItem('klmm',"Killmaim","|cffff8c00Artifact|r|nA slender crescent axe that smells of blood and salt.", 7500, "BTNSpiritWalkerAdeptTraining")
call INV_RegisterItem('rots',"Scepter of the Sea","|cff87ceebUnique Consumable|r|nSummons murlocs.", 1000, "BTNWitchDoctorAdept")
call INV_RegisterItem('axas',"Ancestral Staff","|cffff8c00Artifact|r|nThis intricate staff has many names carved into it.", 3000, "BTNWitchDoctorMaster")
call INV_RegisterItem('mnsf',"Mindstaff","Increases mana.", 1800, "BTNBrilliance")
call INV_RegisterItem('schl',"Scepter of Healing","A staff that heals others.", 4200, "BTNPriestAdept")
call INV_RegisterItem('asbl',"Assassin's Blade","Increases attack damage.", 2000, "BTNDaggerOfEscape")
call INV_RegisterItem('kgal',"Keg of Ale","Increases hit point and mana regeneration.", 850, "BTNBarrel")
call INV_RegisterItem('dphe',"Thunder Phoenix Egg","A rare egg of a Thunder Hawk.", 200, "BTNThunderLizardEgg")
call INV_RegisterItem('dkfw',"Keg of Thunderwater","A keg filled to the brim with the strongest drink available this side of Khaz Modan!", 200, "BTNBarrel")
call INV_RegisterItem('dthb',"Thunderbloom Bulb","An exotic plant well known for its unstable and dangerous properties", 200, "BTNManaFlareOff")
endfunction
//===========================================================================
function InitTrig_add_picked_items takes nothing returns nothing
set gg_trg_add_picked_items = CreateTrigger( )
call TriggerAddAction( gg_trg_add_picked_items, function INV_PickupHandler )
endfunction