Tutorial Guide for Save Load Code

Vulcansurge

Ultra Cool Member
Reaction score
27
Chocobo, your obviously a master at this, taking Effane's trigger and elabourating on it... Can you set up a Save/Load trigger on my new map? Have a look at it and you'll see wat I mean. Im having problems with another thing I've imported which extends a heroes inventory and i tried to make it work with Effane's trigger and yours but I don't think its getting me anywhere.

VULCAN-SURGE's ORPG = http://www.box.net/public/uc5jqkuoa1
 

Chocobo

White-Flower
Reaction score
409
Chocobo, your obviously a master at this, taking Effane's trigger and elabourating on it... Can you set up a Save/Load trigger on my new map? Have a look at it and you'll see wat I mean. Im having problems with another thing I've imported which extends a heroes inventory and i tried to make it work with Effane's trigger and yours but I don't think its getting me anywhere.

VULCAN-SURGE's ORPG = http://www.box.net/public/uc5jqkuoa1

Nope for first question.

Nope for the second question since you should copy and paste your trigger. I'll maybe be going to read it in 8 or 9 hours.
 

Vulcansurge

Ultra Cool Member
Reaction score
27
I dont undersetand wat u mean... Are you saying i need to copy and paste a save/load trigger onto my map?? Then you'll help me? Or are you saying i need to copy the JASS trigger im having problems with before I can do anything with it?

Anyway, if you do help me, explain in brief wat your doing incase it affects me adding custom items to the database later.
 

Vulcansurge

Ultra Cool Member
Reaction score
27
Oh... HEHEHE IM SRY :D . Theres actually four triggers and its pretty long. Some of them i wont need but i dont know which so be prepared for a long read... :eek:

FSGUI MAIN SCRIPT:
Code:
//################################################################################
// 
// script  : FSGUI (FullScreen Graphic User Interface)
// version : 2.01
// date    : 06.08.2005
//
//
// made by : DimonT aka ZibadaMX
//    mail : [email][email protected][/email]
//    icq  : 937160
//    www  : [url]http://dimon.xgm.ru/fsgui/[/url]
// 
//################################################################################
// 
// Module API :
//
//    Initialization:
//
//       fs_SetTrackableGroup(integer tid, integer g)
//       fs_BuildGroupIDs()
//
//
//    Variable Handling:
//
//    1. Globals (configuration):
//       setcfg(string key, string val)
//       cfg(string key)
//       cfgi(string key)
//       cfgr(string key)
//
//    2. Object Specific:
//       set_object_iparam(handle h, string key, integer val)
//       set_object_rparam(handle h, string key, real val)
//       get_object_iparam(handle h, string key)
//       get_object_rparam(handle h, string key)
//
//    3. Session (per-player):
//       fs_GetPlayerID()
//       set_session_param(string key, string val)
//       set_session_iparam(string key, integer val)
//       set_session_rparam(string key, real val)
//       get_session_param(string key)
//       get_session_iparam(string key)
//       get_session_rparam(string key)
// 
//
//
//
//    Trackable grid mapping:
//
//       fs_Coords2Id(integer x, integer y)
//       fs_GetTrackableGroup(integer tid)
//       fs_GetTrackableGroupID(integer tid)
//       fs_GetTriggeringTrackableID()
//       fs_GetTrackableX(integer tid)
//       fs_GetTrackableY(integer tid)
//
//    Text Tags:
//
//       fs_AddNamedTextTag(string name, real x, real y, string msg, real size)
//       fs_SetNamedTextTagText(string name, string msg, real size)
//
//    Effects:
//
//       fs_AddBackgroundEffectXY(string model, real x, real y, boolean useskin)
//       fs_AddBackgroundEffect(string model, integer tid, boolean useskin)
//       fs_AddNamedEffectXY(string name, string model, real x, real y, boolean useskin)
//       fs_AddNamedEffect(string name, string model, integer tid, boolean useskin)
//
//    Callback Functions:
//
//       fs_[modname]_Init()
//       fs_[modname]_ClickHandler()
//       fs_[modname]_HoverHandler()
//       fs_[modname]_Exit()
//
//
// In Game API:
//
//    fs_LoadModule(int playerID, string modname)
//    fs_Shutdown(int playerID)
// 
//
//################################################################################


//################################################################################
constant function fs_H2I takes handle h returns integer
return h
return 0
endfunction

constant function fs_I2U takes integer i returns unit
return i
return null
endfunction

constant function fs_I2T takes integer i returns trigger
return i
return null
endfunction

constant function fs_I2TT takes integer i returns texttag
return i
return null
endfunction

constant function fs_I2It takes integer i returns item
return i
return null
endfunction

constant function fs_I2D takes integer i returns destructable
return i
return null
endfunction

constant function fs_I2FM takes integer i returns fogmodifier
return i
return null
endfunction



//################################################################################
function setcfg takes string key, string val returns nothing
   call StoreString(udg_fs_cache, "config", key, val)
endfunction

function cfg takes string key returns string
   return GetStoredString(udg_fs_cache, "config", key)
endfunction

function cfgr takes string key returns real
   return S2R(cfg(key))
endfunction

function cfgi takes string key returns integer
   return S2I(cfg(key))
endfunction



//################################################################################
function fs_echo takes integer playerID, string msg returns nothing
   if playerID == -1 then
      call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,5.00, msg)
   else
      call DisplayTimedTextToPlayer(Player(playerID),0,0,5.00, msg)
   endif
endfunction


//################################################################################

function get_object_iparam takes handle h, string key returns integer
   return GetStoredInteger(udg_fs_cache, I2S(fs_H2I(h)), key)
endfunction

function set_object_iparam takes handle h, string key, integer val returns nothing
   call StoreInteger(udg_fs_cache, I2S(fs_H2I(h)), key, val)
endfunction

function get_object_rparam takes handle h, string key returns real
   return GetStoredReal(udg_fs_cache, I2S(fs_H2I(h)), key)
endfunction

function set_object_rparam takes handle h, string key, real val returns nothing
   call StoreReal(udg_fs_cache, I2S(fs_H2I(h)), key, val)
endfunction

function flush_object takes handle h returns nothing
   call FlushStoredMission(udg_fs_cache, I2S(fs_H2I(h)))
endfunction

//################################################################################

function get_session_iparam takes string key returns integer
   return GetStoredInteger(udg_fs_cache, "session" + cfg("player"), key)
endfunction

function set_session_iparam takes string key, integer val returns nothing
   call StoreInteger(udg_fs_cache, "session" + cfg("player"), key, val)
endfunction

function get_session_rparam takes string key returns real
   return GetStoredReal(udg_fs_cache, "session" + cfg("player"), key)
endfunction

function set_session_rparam takes string key, real val returns nothing
   call StoreReal(udg_fs_cache, "session" + cfg("player"), key, val)
endfunction

function get_session_param takes string key returns string
   return GetStoredString(udg_fs_cache, "session" + cfg("player"), key)
endfunction

function set_session_param takes string key, string val returns nothing
   call StoreString(udg_fs_cache, "session" + cfg("player"), key, val)
endfunction


//################################################################################
function fs_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 fs_iif takes boolean cond, string s1, string s2 returns string
   if cond then
      return s1
   endif
   return s2
endfunction


//################################################################################
constant function fs_Coords2Id takes integer x, integer y returns integer
   return y * 20 + x
endfunction


//################################################################################
function fs_BuildGroupIDs takes nothing returns nothing
   local integer i = 0
   local integer g
   local integer array count
   loop
      exitwhen i >= 200
      set g = get_session_iparam("tk_group" + I2S(i))
      if  g != -1 then
         call set_session_iparam("tk_groupid" + I2S(i), count[g]) 
         set count[g] = count[g] + 1
      else
         call set_session_iparam("tk_groupid" + I2S(i), -1) 
      endif
      set i = i + 1
   endloop
endfunction


//################################################################################
function fs_SetTrackableGroup takes integer tid, integer g returns nothing
   call set_session_iparam("tk_group" + I2S(tid), g) 
endfunction


//################################################################################
function fs_GetTrackableGroup takes integer tid returns integer
   return get_session_iparam("tk_group" + I2S(tid)) 
endfunction


//################################################################################
function fs_GetTrackableGroupID takes integer tid returns integer
   return get_session_iparam("tk_groupid" + I2S(tid)) 
endfunction

//################################################################################
function fs_GetTriggeringTrackableID takes nothing returns integer
   return get_session_iparam("fs_trigger_tid")
endfunction


//################################################################################
function fs_GetPlayerID takes nothing returns integer
   return cfgi("player")
endfunction

//################################################################################
function fs_GetTrackableX takes integer tid returns real
   return cfgr("tk_" + I2S(tid) + "_x" + I2S(fs_GetPlayerID()))
   return get_session_rparam("tk_x" + I2S(tid))
endfunction

//################################################################################
function fs_GetTrackableY takes integer tid returns real
   return cfgr("tk_" + I2S(tid) + "_y" + I2S(fs_GetPlayerID()))
   return get_session_rparam("tk_y" + I2S(tid))
endfunction


//################################################################################
function fs_AddNamedTextTag takes string name, real x, real y, string msg, real size returns nothing
   local texttag tt
   local integer id = get_session_iparam("fs_texttags")

   call DestroyTextTag(fs_I2TT(get_session_iparam("fs_texttag_" + name)))

   if msg == "" then
      call set_session_iparam("fs_texttag_" + name, 0)
      return
   endif
   if size == 0 then
      set size = cfgr("fs_texttag_size")
   endif

   set tt = CreateTextTag()
   call SetTextTagPos(tt, get_session_rparam("fs_base_x") + x, get_session_rparam("fs_base_y") + y, 0)
   call SetTextTagColor(tt, 255, 255, 255, 255)
   call SetTextTagVelocity(tt, 0, 0)
   call SetTextTagVisibility(tt, true)
   call SetTextTagText(tt, msg, size)
   call SetTextTagPermanent(tt, true)

   call set_session_iparam("fs_texttag_" + name,  fs_H2I(tt))
   call set_session_iparam("fs_texttag" + I2S(id), fs_H2I(tt))
   call set_session_iparam("fs_texttags", id + 1)
//   call debugMsg("fs_AddNamedTextTag: name = " + name + " x = " + R2SW(x, 0, 0) + ", y = " + R2SW(y, 0, 0) + ",  msg = " + msg)
endfunction


//################################################################################
function fs_SetNamedTextTagText takes string name, string msg, real size returns nothing
   local texttag tt = fs_I2TT(get_session_iparam("fs_texttag_" + name))
   if size == 0 then
      set size = cfgr("fs_texttag_size")
   endif
   call SetTextTagText(tt, msg, size)
endfunction



//################################################################################
function fs_PlaySound takes string soundfile returns nothing
   if cfgi("fs_sound") == 0 then
      return
   endif
   if Player(fs_GetPlayerID()) == GetLocalPlayer() then
      call PlaySound(soundfile)
   endif
endfunction


//################################################################################
function fs_RegisterEffect takes integer id, string name returns nothing
   call StoreInteger(udg_fs_cache, "FX", name, id)
endfunction



//################################################################################
function fs_AddBackgroundEffectXY takes string modelfile, real x, real y, boolean useskin returns destructable
   local destructable d 
   local integer id = get_session_iparam("fs_effects")

   if useskin then
      set modelfile = modelfile + get_session_param("fs_skin")
   endif
   set d = CreateDestructable(GetStoredInteger(udg_fs_cache, "FX", modelfile), get_session_rparam("fs_base_x") + x, get_session_rparam("fs_base_y") + y, 0, 1.0, 1)

   call set_session_iparam("fs_effect" + I2S(id), fs_H2I(d))
   call set_session_iparam("fs_effects", id + 1)
   return d
endfunction


//################################################################################
function fs_AddBackgroundEffect takes string modelfile, integer tid, boolean useskin returns destructable
   return fs_AddBackgroundEffectXY(modelfile, fs_GetTrackableX(tid), fs_GetTrackableY(tid), useskin)
endfunction


//################################################################################
function fs_AddNamedEffectXY takes string name, string modelfile, real x, real y, boolean useskin returns nothing
   call RemoveDestructable(fs_I2D(get_session_iparam("fs_effect_" + name)))
   if modelfile != "" then
      call set_session_iparam("fs_effect_" + name, fs_H2I(fs_AddBackgroundEffectXY(modelfile, x, y, useskin)))
   else
      call set_session_iparam("fs_effect_" + name, 0)
   endif
endfunction


//################################################################################
function fs_AddNamedEffect takes string name, string modelfile, integer tid, boolean useskin returns nothing
   call fs_AddNamedEffectXY(name, fs_iif(tid >= 0, modelfile, ""), fs_GetTrackableX(tid), fs_GetTrackableY(tid), useskin)
endfunction


//################################################################################
function fs_ClickHandler takes nothing returns nothing
   local integer tid = get_object_iparam(GetTriggeringTrackable(), "id")
   local integer p   = get_object_iparam(GetTriggeringTrackable(), "p")

   call setcfg("player", I2S(p))
   if get_session_iparam("fs_enabled") == 0 then
      return
   endif

   call set_session_iparam("fs_trigger_tid", tid)

   call ExecuteFunc(get_session_param("fs_module") + "_ClickHandler")
endfunction


//################################################################################
function fs_HoverHandler takes nothing returns nothing
   local integer tid = get_object_iparam(GetTriggeringTrackable(), "id")
   local integer p   = get_object_iparam(GetTriggeringTrackable(), "p")

   call setcfg("player", I2S(p))
   if get_session_iparam("fs_enabled") == 0 then
      return
   endif

   call set_session_iparam("fs_trigger_tid", tid)

   call ExecuteFunc(get_session_param("fs_module") + "_HoverHandler")
endfunction



//################################################################################
constant function fs_GetRaceID takes integer p returns string
   local race r = GetPlayerRace(Player(p))
   if r == RACE_NIGHTELF then
      return "4"
   elseif r == RACE_UNDEAD then
      return "2"
   elseif r == RACE_ORC then
      return "3"
   endif
   return "1"
endfunction



//################################################################################
function fs_Shutdown takes integer p returns nothing
   local integer i
   local destructable d
   local texttag tt

   local real x
   local real y

   call setcfg("player", I2S(p))

   if get_session_iparam("fs_enabled") == 0 then
      return
   endif


   // ############ reset camera and visibility ############
   if Player(p) == GetLocalPlayer() then 
      call SetCameraBoundsToRect(bj_mapInitialCameraBounds)
      call ResetToGameCamera(0)
      call SetCameraPosition(get_session_rparam("fs_cam_x"), get_session_rparam("fs_cam_y"))
   endif

   set x = get_session_rparam("fs_base_x")
   set y = get_session_rparam("fs_base_y")

   call DestroyFogModifier(fs_I2FM(get_session_iparam("fs_fogmodifier")))
   call SetFogStateRect(Player(p), FOG_OF_WAR_MASKED, Rect(x + 100 , y + 100, x + 2100, y + 1100), false)


   // ##### exec module shutdown func #####

   call ExecuteFunc(get_session_param("fs_module") + "_Exit")

   // ########## do some cleanup ###########

   set i = get_session_iparam("fs_effects") - 1
   loop
      exitwhen i < 0
      set d = fs_I2D(get_session_iparam("fs_effect" + I2S(i)))
      call RemoveDestructable(d)
      set i = i - 1
   endloop

   set i = get_session_iparam("fs_texttags") - 1
   loop
      exitwhen i < 0
      set tt = fs_I2TT(get_session_iparam("fs_texttag" + I2S(i)))
      call DestroyTextTag(tt)
      set i = i - 1
   endloop


   call set_session_iparam("fs_enabled", 0)
endfunction


//################################################################################
function fs_LoadModule takes integer p, string modname returns nothing
   local integer i = 0
   local real x
   local real y
   local fogmodifier fm

   if p >= cfgi("max_players") then
      call fs_echo(p, "|c00ff0000ERROR:|r cannot access fullscreen interface")
      call fs_echo(p, "(try increasing max_players setting in map configuration)")
      return
   endif

   call setcfg("player", I2S(p))

   if get_session_iparam("fs_enabled") == 1 then
      call fs_Shutdown(p)
   endif

   call FlushStoredMission(udg_fs_cache, "session" + I2S(p))

   set x = cfgr("fs_base_x" + I2S(p))
   set y = cfgr("fs_base_y" + I2S(p))
   call set_session_rparam("fs_base_x", x)
   call set_session_rparam("fs_base_y", y)


   set fm = CreateFogModifierRect(Player(p), FOG_OF_WAR_VISIBLE, Rect(x + 100 , y + 100, x + 2100, y + 1100), false, false)
   call set_session_iparam("fs_fogmodifier", fs_H2I(fm))
   call FogModifierStart(fm)

   set x = x + 1024
   set y = y + 512

   // ############# set camera #############

   call set_session_param("fs_module", modname)
   call set_session_rparam("fs_cam_x", GetCameraTargetPositionX())
   call set_session_rparam("fs_cam_y", GetCameraTargetPositionY())

   if Player(p) == GetLocalPlayer() then
      call SetCameraPosition(x,y)
      call SetCameraBounds(x,y,x,y,x,y,x,y)
   endif



   // ############## init vars #############

   call set_session_iparam("fs_enabled", 1)
   call set_session_iparam("fs_effect_count", 0)

   if cfgi("fs_skin") == 0 then
      call set_session_param("fs_skin", fs_GetRaceID(p))
   else
      call set_session_param("fs_skin", cfg("fs_skin"))
   endif

   loop
      exitwhen i >= 200
      call set_session_iparam("tk_group" + I2S(i), -1)
      set i = i + 1
   endloop

   // ##### exec module init functions #####

   call ExecuteFunc(modname + "_Init")
   call fs_BuildGroupIDs()
endfunction


//################################################################################
function fs_InitPlayer takes nothing returns nothing
   local timer tm = GetExpiredTimer()
   local integer p = cfgi("player")
   local integer i = 0
   local integer j
   local trackable tk
   local trigger t
   local real x
   local real y

   if p >= cfgi("max_players") then
      call DestroyTimer(tm)
      return
   endif



   set x = cfgr("base_x")
   set y = cfgr("base_y") + p * 1200

   if y + 1100 > GetRectMaxY(GetWorldBounds()) then
      call fs_echo(-1, "|c00ff0000WARNING:|r FSGUI Init: not enough map space for players " + I2S(p + 1) + "+")
      call fs_echo(-1, "(try increasing your map height)")
      call setcfg("max_players", I2S(p))
      call DestroyTimer(tm)
      return
   endif

   call setcfg("fs_base_x" + I2S(p), R2S(x))
   call setcfg("fs_base_y" + I2S(p), R2S(y))

   set i = 0
   loop
      exitwhen i >= 10
      set j = 0
      loop
         exitwhen j >= 20
         set tk = CreateTrackable("square.mdx", x + 74 + 100 * j, y + 962 - 100 * i, 0)
         set t = CreateTrigger()
         call TriggerRegisterTrackableHitEvent(t, tk)
         call TriggerAddAction(t, function fs_ClickHandler)
         set t = CreateTrigger()
         call TriggerRegisterTrackableTrackEvent(t, tk)
         call TriggerAddAction(t, function fs_HoverHandler)
         call set_object_iparam(tk, "p", p)
         call set_object_iparam(tk, "id", i * 20 + j)

         call setcfg("tk_" + I2S(i * 20 + j) + "_x" + I2S(p), R2S(74 + (100*j)))
         call setcfg("tk_" + I2S(i * 20 + j) + "_y" + I2S(p), R2S(1024 - 62 - (100*i)))
         set j = j + 1
      endloop

      // ### dummy left & right border trackables
      call CreateTrackable("square.mdx", x + 74 + 2000, y + 962 - 100 * i, 0)
      call CreateTrackable("square.mdx", x + 74 - 100 , y + 962 - 100 * i, 0)

      set i = i + 1
   endloop

   // ### dummy top & bottom border trackables

   set i = -1
   loop
      exitwhen i > 20
      call CreateTrackable("square.mdx", x + 74 + 100 * i, y + 1062 , 0)
      call CreateTrackable("square.mdx", x + 74 + 100 * i, y -   38, 0)

      set i = i + 1
   endloop

   call setcfg("player", I2S(p + 1))

endfunction

//################################################################################
function fs_Initialize takes nothing returns nothing
   local integer i = 0
   local integer p = 0
   local integer j
   local trigger t
   local timer tm
   local real x
   local real y

   // ############### set up workspace ##############
   call setcfg("base_x", R2S(GetRectMinX(bj_mapInitialPlayableArea) + 100.00))
   call setcfg("base_y", R2S(GetRectMinY(bj_mapInitialPlayableArea) + 100.00))

   set bj_mapInitialPlayableArea = Rect(cfgr("base_x") + 2300, GetRectMinY(bj_mapInitialPlayableArea), GetRectMaxX(bj_mapInitialPlayableArea), GetRectMaxY(bj_mapInitialPlayableArea))


   // ############### set up path blocker line ##############
   set x = cfgr("base_x") + 2200
   set y = GetRectMinY(GetWorldBounds())

   loop
      exitwhen y > GetRectMaxY(GetWorldBounds())
      call CreateDestructable('BX00', x, y, 0, 1.28, 0)
      set y = y + 128
   endloop

   // ############### auto detect max players if necessary ##############
   if cfgi("max_players") <= 0 then
      loop
         exitwhen i >= 12
         if GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING then
            call setcfg("max_players", I2S(i + 1))
         endif
         set i = i + 1
      endloop
   endif

   set tm = CreateTimer()
   call TimerStart(tm, 0.00, true, function fs_InitPlayer)
endfunction



//################################################################################
function fs_ForceCameraAction takes nothing returns nothing
   if GetStoredInteger(udg_fs_cache, "session" + I2S(GetPlayerId(GetLocalPlayer())), "fs_enabled") != 1 then
      return
   endif
   call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, 269.00, 0 )
   call SetCameraField(CAMERA_FIELD_ROTATION, 90.00, 0 )
   call SetCameraField(CAMERA_FIELD_FARZ, 5000.00, 0 )
   call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, 3100.00, 0 )
   call SetCameraField(CAMERA_FIELD_FIELD_OF_VIEW, 44.00, 0 )
endfunction




//################################################################################
function InitTrig_FSGUI_main_script takes nothing returns nothing
local trigger t

set t = CreateTrigger()
call TriggerRegisterTimerEventPeriodic(t, 0.05)
call TriggerAddAction(t, function fs_ForceCameraAction)

set gg_trg_FSGUI_main_script = CreateTrigger()
call TriggerAddAction(gg_trg_FSGUI_main_script, function fs_Initialize)

set udg_fs_cache = InitGameCache("FSGUI.w3v")
call FlushGameCache(udg_fs_cache)
call SaveGameCache(udg_fs_cache)
set udg_fs_cache = InitGameCache("FSGUI.w3v")
endfunction
CONFIGURATION:
Code:
//################################################################################
function InitTrig_configuration takes nothing returns nothing

// ### Note: ALL settings in this section are strings, so they must be enclosed in quotes
// ### Most of these settings could be changed at any point of game via setcfg function


// #############################################
// #######     FSGUI basic settings      #######
// #############################################


   // number of players allowed to access the fullscreen panel
   // value of 0 enables auto-detection, i.e. it will be set to max player id used in the game
   // note that each player requires about extra 10 cells of dead-zone height
   call setcfg("max_players", "0")

   // default text labels size
   call setcfg("fs_texttag_size", "0.0204")

   // style used in interface:
   //   0 - Auto (depends on player race)
   //   1 - Human
   //   2 - Undead
   //   3 - Orc
   //   4 - Night Elf
   call setcfg("fs_skin", "0")

   // enables or disables sound effects
   // !!!WARNING!!! it seems to be multiplayer incompatible, that's why it's disabled by default
   // set to 1 in single player maps ONLY!
   call setcfg("fs_sound", "0")


// #############################################
// ####### Fullscreen Inventory settings #######
// #############################################


   // inventory ability id
   // replace 'A000' below with the actual id of "inventory screen" ability
   // (press Ctrl+D in Object Editor to view codes)
   call setcfg("inv100_ability", I2S('A008'))

   // enables / disables selling items directly from backpack:
   //   0 - always off
   //   1 - only if standing at most sell_range away from closest shop
   //   2 - always on
   call setcfg("inv100_sell_mode" ,   "1")
   call setcfg("inv100_sell_range",   "400")

   // part of actual cost paid when selling (1.00 = 100%)
   call setcfg("inv100_sell_rate",    "0.50")

   // enables / disables using or dropping items directly from backpack: 0 - off, 1 - on
   call setcfg("inv100_allow_use",    "1")
   call setcfg("inv100_allow_drop",   "1")

   // default backpack dimensions - min 1, max 10
   // you can explicitly set backpack dimensions of any unit using inv100_SetInventorySize function
   // (see "init" trigger for an example)
   call setcfg("inv100_default_rows", "5")
   call setcfg("inv100_default_cols", "5")

   // if you had camera locked on a unit before entering the inventory screen, this lock will be lost
   // setting this option to "1" will force camera re-locking to the unit using the inventory
   call setcfg("inv100_lock_cam", "0")

   // allow exiting the inventory by pressing ESC key
   call setcfg("inv100_allow_escape", "1")

   // enables / disables fade filter effect when entering / exiting inventory
   call setcfg("inv100_fadefilter", "1")


// #############################################
// ####### background effects database  ########
// #############################################

// do not change unless you know what you're doing

call fs_RegisterEffect('BX00', "square")
call fs_RegisterEffect('BX01', "borderD1")
call fs_RegisterEffect('BX02', "borderD2")
call fs_RegisterEffect('BX03', "borderD3")
call fs_RegisterEffect('BX04', "borderD4")
call fs_RegisterEffect('BX05', "borderL1")
call fs_RegisterEffect('BX06', "borderL2")
call fs_RegisterEffect('BX07', "borderL3")
call fs_RegisterEffect('BX08', "borderL4")
call fs_RegisterEffect('BX09', "borderR1")
call fs_RegisterEffect('BX10', "borderR2")
call fs_RegisterEffect('BX11', "borderR3")
call fs_RegisterEffect('BX12', "borderR4")
call fs_RegisterEffect('BX13', "borderU1")
call fs_RegisterEffect('BX14', "borderU2")
call fs_RegisterEffect('BX15', "borderU3")
call fs_RegisterEffect('BX16', "borderU4")
call fs_RegisterEffect('BX17', "central1")
call fs_RegisterEffect('BX18', "central2")
call fs_RegisterEffect('BX19', "central3")
call fs_RegisterEffect('BX20', "central4")
call fs_RegisterEffect('BX21', "cornerDL1")
call fs_RegisterEffect('BX22', "cornerDL2")
call fs_RegisterEffect('BX23', "cornerDL3")
call fs_RegisterEffect('BX24', "cornerDL4")
call fs_RegisterEffect('BX25', "cornerDR1")
call fs_RegisterEffect('BX26', "cornerDR2")
call fs_RegisterEffect('BX27', "cornerDR3")
call fs_RegisterEffect('BX28', "cornerDR4")
call fs_RegisterEffect('BX29', "cornerUL1")
call fs_RegisterEffect('BX30', "cornerUL2")
call fs_RegisterEffect('BX31', "cornerUL3")
call fs_RegisterEffect('BX32', "cornerUL4")
call fs_RegisterEffect('BX33', "cornerUR1")
call fs_RegisterEffect('BX34', "cornerUR2")
call fs_RegisterEffect('BX35', "cornerUR3")
call fs_RegisterEffect('BX36', "cornerUR4")
call fs_RegisterEffect('BX37', "cost")
call fs_RegisterEffect('BX38', "description1")
call fs_RegisterEffect('BX39', "description2")
call fs_RegisterEffect('BX40', "description3")
call fs_RegisterEffect('BX41', "description4")
call fs_RegisterEffect('BX42', "empinv1")
call fs_RegisterEffect('BX43', "empinv2")
call fs_RegisterEffect('BX44', "empinv3")
call fs_RegisterEffect('BX45', "empinv4")
call fs_RegisterEffect('BX46', "selecter1")
call fs_RegisterEffect('BX47', "selecter2")
call fs_RegisterEffect('BX48', "selecter3")
call fs_RegisterEffect('BX49', "selecter4")
call fs_RegisterEffect('BX50', "selector")
call fs_RegisterEffect('BX51', "number")
call fs_RegisterEffect('BX52', "BTNAutoPickup")
call fs_RegisterEffect('BX53', "BTNDrop")
call fs_RegisterEffect('BX54', "BTNExit")
call fs_RegisterEffect('BX55', "BTNSell")
call fs_RegisterEffect('BX56', "BTNUse")
call fs_RegisterEffect('BX57', "DISBTNDrop")
call fs_RegisterEffect('BX58', "DISBTNSell")
call fs_RegisterEffect('BX59', "DISBTNUse")


endfunction
 

Vulcansurge

Ultra Cool Member
Reaction score
27
INVENTORY MODULE:

Code:
//################################################################################
// 
// script  : FSGUI module - 100-slot inventory
// version : 2.01
// date    : 06.08.2005
// 
//
// made by : DimonT        |   Illisor
//    mail : [email][email protected][/email]  |   [email][email protected][/email]
//    icq  : 937160        |   221013519
//    www  : [url]http://dimon.xgm.ru/fsgui/[/url]
// 
//################################################################################


//################################################################################
function inv100_ItemID2String takes integer itemid returns string
   return fs_chr(itemid/256/256/256) + fs_chr(ModuloInteger(itemid/256/256, 256)) + fs_chr(ModuloInteger(itemid/256, 256)) + fs_chr(ModuloInteger(itemid, 256))
endfunction


//################################################################################
function inv100_GetItemName takes integer itemId returns string
   local integer i = 0
   if HaveStoredString(udg_fs_cache, I2S(itemId), "name") then
      return GetStoredString(udg_fs_cache, I2S(itemId), "name")
   endif
   return "Unknown Item (" + inv100_ItemID2String(itemId) + ")"
endfunction

//################################################################################
function inv100_GetItemDesc takes integer itemId returns string
   local integer i = 0
   if HaveStoredString(udg_fs_cache, I2S(itemId), "desc") then
      return GetStoredString(udg_fs_cache, I2S(itemId), "desc")
   endif
   return "read how to add your own custom items in the \"init item settings\" trigger of the map"
endfunction


//################################################################################
function inv100_GetItemFX takes integer itemId returns string
   if itemId == 0 then
       return "empinv" + get_session_param("fs_skin")
   endif
   if not HaveStoredInteger(udg_fs_cache, "FX", "inv100_item" + I2S(itemId)) then
      set itemId = 'sclp'
   endif
   return "inv100_item" + I2S(itemId)
endfunction


//################################################################################
function inv100_GetItemCost takes integer itemId returns integer
   if HaveStoredInteger(udg_fs_cache, I2S(itemId), "cost") then
      return R2I(GetStoredInteger(udg_fs_cache, I2S(itemId), "cost") * cfgr("inv100_sell_rate"))
   endif
   return 0
endfunction


//################################################################################
function inv100_IsMainInventoryFull takes unit u returns boolean
   local integer i = 0
   loop
      exitwhen i >= 6
      if UnitItemInSlot(u, i) == null then
         return false
      endif
      set i = i + 1
   endloop
   return true
endfunction


//################################################################################
function inv100_IsEnabled takes player p returns boolean
   call setcfg("player", I2S(GetPlayerId(p)))
   return get_session_iparam("fs_enabled") == 1 and get_session_param("fs_module") == "inv100"
endfunction


//################################################################################
function inv100_UnitItemInSlot takes unit u, integer slot returns item
   return fs_I2It(get_object_iparam(u, "inv100_item" + I2S(slot)))
endfunction


//################################################################################
function UnitAddItemToSlotMy takes unit u, item it, integer slot returns nothing
   local integer i = 0

// ### following simple order method doesn't seem to work w/ paused units... :/
//   call UnitAddItem(u, it)
//   call IssueTargetOrderById(u, 852002 + slot, it)
//   return

   call UnitRemoveItem(u, it)
   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 inv100_UnitAddItemToSlot takes unit u, item it, integer slot returns nothing
   if GetItemTypeId(inv100_UnitItemInSlot(u, slot)) != 0 or IsItemPowerup(it) then
      return
   endif
   call UnitRemoveItem(u, it)
   call set_object_iparam(u, "inv100_item" + I2S(slot), fs_H2I(it))
   call SetItemVisible(it, false)
   call SetItemPosition(it, get_session_rparam("fs_base_x") - 100, get_session_rparam("fs_base_y") - 100 + slot * 10)
endfunction



//################################################################################
function inv100_UnitDropItemSlot takes unit u, integer slot returns nothing
   local item it = fs_I2It(get_object_iparam(u, "inv100_item" + I2S(slot)))
   call SetItemVisible(it, true)
   call SetItemPosition(it, GetUnitX(u), GetUnitY(u))
   call set_object_iparam(u, "inv100_item" + I2S(slot), 0)
endfunction


//################################################################################
function inv100_UnitHasItem takes unit u, item it returns boolean
   local integer i = 0
   local integer slots = get_object_iparam(u, "inv100_rows") * get_object_iparam(u, "inv100_cols")

   loop
      exitwhen i >= slots
      if inv100_UnitItemInSlot(u, i) == it then
         return true
      endif
      set i = i + 1
   endloop
   return false
endfunction


//################################################################################
function inv100_UnitHasItemOfType takes unit u, integer it returns boolean
   local integer i = 0
   local integer slots = get_object_iparam(u, "inv100_rows") * get_object_iparam(u, "inv100_cols")

   loop
      exitwhen i >= slots
      if GetItemTypeId(inv100_UnitItemInSlot(u, i)) == it then
         return true
      endif
      set i = i + 1
   endloop
   return false
endfunction


//################################################################################
function inv100_SetInventorySize takes unit u, integer rows, integer cols returns nothing
   if rows < 1 then
     set rows = 1
   elseif rows > 10 then
     set rows = 10
   endif
   if cols < 1 then
     set cols = 1
   elseif cols > 10 then
     set cols = 10
   endif
   call set_object_iparam(u, "inv100_rows", rows)
   call set_object_iparam(u, "inv100_cols", cols)
endfunction


//################################################################################
function inv100_DrawItem takes integer tid, item it returns nothing
   call fs_AddNamedEffect("item" + I2S(tid) , inv100_GetItemFX(GetItemTypeId(it)), tid, false)
   if GetItemCharges(it) > 0 then
      call fs_AddNamedEffectXY("charges" + I2S(tid), "number", fs_GetTrackableX(tid) + 20, fs_GetTrackableY(tid) - 25, false)
      call fs_AddNamedTextTag("charges" + I2S(tid), fs_GetTrackableX(tid) + 1.65 * ModuloInteger(tid, 20) + 2, fs_GetTrackableY(tid) - 30 - 1.8 * I2R(R2I(tid / 20)), I2S(GetItemCharges(it)), 0.015)
   else
      call fs_AddNamedEffectXY("charges" + I2S(tid), "", 0, 0, false)
      call fs_AddNamedTextTag("charges" + I2S(tid), 0, 0, "", 0)
   endif
endfunction


//################################################################################
function inv100_UseItem takes nothing returns nothing
   local timer t = GetExpiredTimer()
   local unit u = fs_I2U(get_object_iparam(t, "unit"))
   local integer charges = get_object_iparam(t, "charges")
   local integer tid = get_object_iparam(t, "tid")
   local integer g = fs_GetTrackableGroup(tid)
   local integer slot = fs_GetTrackableGroupID(tid)
   local item it = UnitItemInSlot(u, 0)

   call setcfg("player", I2S(get_object_iparam(t, "player")))

   if GetItemCharges(it) > 0 then
      if g == 0 then
         call UnitAddItemToSlotMy(u, it, slot)
      else
         call inv100_UnitAddItemToSlot(u, it, slot)
      endif
   else
      call fs_SetNamedTextTagText("item_name", " ", 0)
      call fs_SetNamedTextTagText("item_desc", " ", 0)
      call fs_AddNamedEffectXY("cost", "", 0, 0, false)
      call fs_SetNamedTextTagText("item_cost", " ", 0)
      call fs_SetNamedTextTagText("item_hint", " ", 0)
   endif

   if GetItemCharges(it) != charges then
      call inv100_DrawItem(tid, it)
      call fs_PlaySound("Abilities\\Spells\\Items\\AIam\\Tomes.wav")
      call set_session_iparam("selected_item", 0)
      call set_session_iparam("selected_cell", -1)
      call fs_SetNamedTextTagText("item_hint", " ", 0)
      call fs_SetNamedTextTagText("button_label", " ", 0)
      call fs_AddNamedEffect("item_select", "", 0, false)

      call fs_AddNamedEffect("button_sell", "DISBTNSell", get_session_iparam("button_sell_pos"), false)
      call fs_AddNamedEffect("button_drop", "DISBTNDrop", get_session_iparam("button_drop_pos"), false)
      call fs_AddNamedEffect("button_use" , "DISBTNUse" , get_session_iparam("button_use_pos") , false)
   else
      call fs_PlaySound("Sound\\Interface\\Error.wav")
      call fs_SetNamedTextTagText("item_hint", "|c00ff0000Cannot use this item.|r", 0)
   endif

   call UnitAddItemToSlotMy(u, inv100_UnitItemInSlot(u, -1), 0)
   call set_object_iparam(u, "inv100_item-1", 0)

   call PauseUnit(u, true)

   call DestroyTimer(t)
   call flush_object(t)
endfunction


//################################################################################
function inv100_ClickHandler takes nothing returns nothing
   local integer tid = fs_GetTriggeringTrackableID()
   local integer g = fs_GetTrackableGroup(tid)
   local integer slot = fs_GetTrackableGroupID(tid)
   local integer p = fs_GetPlayerID()
   local unit u = fs_I2U(get_session_iparam("unit"))

   local integer tid2 = get_session_iparam("selected_cell")
   local integer g2 = fs_GetTrackableGroup(tid2)
   local integer slot2 = fs_GetTrackableGroupID(tid2)
   local integer charges

   local string str
   local item it
   local item it2 = fs_I2It(get_session_iparam("selected_item"))

   local timer t

   if g == -1 then
      return
   endif

   if g == 2 then
      call fs_Shutdown(fs_GetPlayerID())
      return
   endif


// ####### validity checks #######

   if g == 3 and not IsItemSellable(it2) then
      return
   endif

   if g == 4 and (GetItemCharges(it2) == 0 or GetItemTypeId(inv100_UnitItemInSlot(u, -1)) != 0) then
      return
   endif

   if g == 5 and GetItemTypeId(it2) == 0 then
      return
   endif


// ####### auto-pickup button #######

   if g == 6 then
      if get_object_iparam(u, "inv100_auto_pickup") == 0 then
         if inv100_IsMainInventoryFull(u) then
            call fs_SetNamedTextTagText("button_label", "|cffffcc00Free at least one slot in your main inventory.|r", 0)
            call fs_PlaySound("Sound\\Interface\\Error.wav")
            return
         endif

         call set_object_iparam(u, "inv100_auto_pickup", 1)
         call fs_AddNamedEffect("button_pickup_selected", "selector", get_session_iparam("button_pickup_pos"), false)
      else
         call set_object_iparam(u, "inv100_auto_pickup", 0)
         call fs_AddNamedEffect("button_pickup_selected", "", 0, false)
      endif
      set str = "Pickup to Extended Inventory: |cffffcc00" + fs_iif(get_object_iparam(u, "inv100_auto_pickup") == 1, "ON", "OFF") + "|r"
      call fs_SetNamedTextTagText("button_label", str, 0)
      call fs_PlaySound("Sound\\Interface\\AutoCastButtonClick1.wav")
      return
   endif


// ####### use button #######

   if g == 4 then
      if g2 == 0 then
         call UnitRemoveItem(u, it2)
      else
         call inv100_UnitDropItemSlot(u, slot2)
      endif
 
      call inv100_UnitAddItemToSlot(u, UnitItemInSlot(u, 0), -1)

      call UnitAddItemToSlotMy(u, it2, 0)

      set t = CreateTimer()
      call TimerStart(t, 0.02, false, function inv100_UseItem)
      call set_object_iparam(t, "unit", fs_H2I(u))
      call set_object_iparam(t, "player", p)
      call set_object_iparam(t, "charges", GetItemCharges(it2))
      call set_object_iparam(t, "tid", tid2)

      call PauseUnit(u, false)
      call UnitUseItem(u, it2)
      return
   endif

// ####### deselect current item #######

   if tid2 != -1 then
      call set_session_iparam("selected_item", 0)
      call set_session_iparam("selected_cell", -1)
      call fs_SetNamedTextTagText("item_hint", " ", 0)
      call fs_AddNamedEffect("item_select", "", 0, false)

      call fs_AddNamedEffect("button_sell", "DISBTNSell", get_session_iparam("button_sell_pos"), false)
      call fs_AddNamedEffect("button_drop", "DISBTNDrop", get_session_iparam("button_drop_pos"), false)
      call fs_AddNamedEffect("button_use" , "DISBTNUse" , get_session_iparam("button_use_pos") , false)
   endif


// ####### sell button #######

   if g == 3 then
      call SetPlayerState(Player(p), PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(Player(p), PLAYER_STATE_RESOURCE_GOLD) + inv100_GetItemCost(GetItemTypeId(it2)))
      if g2 == 1 then
         call set_object_iparam(u, "inv100_item" + I2S(slot2), 0)
      endif
      call RemoveItem(it2)
      call inv100_DrawItem(tid2, null)
      call fs_SetNamedTextTagText("item_name", " ", 0)
      call fs_SetNamedTextTagText("item_desc", " ", 0)
      call fs_AddNamedEffectXY("cost", "", 0, 0, false)
      call fs_SetNamedTextTagText("item_cost", " ", 0)
      call fs_SetNamedTextTagText("item_hint", " ", 0)
      call fs_SetNamedTextTagText("button_label", " ", 0)
      call fs_PlaySound("Sound\\Interface\\ReceiveGold.wav")
      return
   endif


// ####### drop button #######

   if g == 5 then
      if g2 == 0 then
         call UnitRemoveItem(u, it2)
      else
         call inv100_UnitDropItemSlot(u, slot2)
      endif
      call inv100_DrawItem(tid2, null)
      call fs_SetNamedTextTagText("item_name", " ", 0)
      call fs_SetNamedTextTagText("item_desc", " ", 0)
      call fs_AddNamedEffectXY("cost", "", 0, 0, false)
      call fs_SetNamedTextTagText("item_cost", " ", 0)
      call fs_SetNamedTextTagText("item_hint", " ", 0)
      call fs_SetNamedTextTagText("button_label", " ", 0)
      call fs_PlaySound("Sound\\Interface\\BigButtonClick.wav")
      return
   endif




// ####### item zones #######

   if g != 0 and g != 1 then
      return
   endif


   if g == 0 then
      set it = UnitItemInSlot(u, slot)
   else
      set it = inv100_UnitItemInSlot(u, slot)
   endif


// ####### select / deselect if clicked on item #######

   if GetItemTypeId(it) != 0 then
      call fs_PlaySound("Sound\\Interface\\MouseClick1.wav")
      if tid == tid2 then
         return
      endif

      call set_session_iparam("selected_item", fs_H2I(it))
      call set_session_iparam("selected_cell", tid)
      call fs_SetNamedTextTagText("item_hint", "|c00999999Click on empty slot to move this item.|r", 0)
      call fs_AddNamedEffect("item_select", "selecter", tid, true)

      if IsItemSellable(it) then
         call fs_AddNamedEffect("button_sell", "BTNSell", get_session_iparam("button_sell_pos"), false)
      endif
      if GetItemTypeId(it) != 0 then
         call fs_AddNamedEffect("button_drop", "BTNDrop", get_session_iparam("button_drop_pos"), false)
      endif
      if GetItemCharges(it) > 0 then
         call fs_AddNamedEffect("button_use" , "BTNUse" , get_session_iparam("button_use_pos") , false)
      endif
      return
   endif


// ####### clicked on empty slot and no item selected #######


   if GetItemTypeId(it2) == 0 then
      return
   endif


// ####### move item #######

   if g2 == 0 then
      call UnitRemoveItem(u, it2)
   else
      call inv100_UnitDropItemSlot(u, slot2)
   endif

   if g == 0 then
      call UnitAddItemToSlotMy(u, it2, slot)
   else
      call inv100_UnitAddItemToSlot(u, it2, slot)
   endif

   call inv100_DrawItem(tid2, null)
   call inv100_DrawItem(tid , it2)
   call fs_PlaySound("Sound\\Interface\\BigButtonClick.wav")

   if inv100_IsMainInventoryFull(u) then
      call set_object_iparam(u, "inv100_auto_pickup", 0)
      call fs_AddNamedEffect("button_pickup_selected", "", 0, false)
   endif

endfunction


//################################################################################
function inv100_HoverHandler takes nothing returns nothing
   local integer tid = fs_GetTriggeringTrackableID()
   local integer g = fs_GetTrackableGroup(tid)
   local integer slot = fs_GetTrackableGroupID(tid)


   local integer p = fs_GetPlayerID()
   local unit u = fs_I2U(get_session_iparam("unit"))
   local string str
   local item it

   if get_session_iparam("selected_cell") != -1 then
      set it = fs_I2It(get_session_iparam("selected_item"))
   elseif g == 0 then
      set it = UnitItemInSlot(u, slot)
   elseif g == 1 then
      set it = inv100_UnitItemInSlot(u, slot)
   else
      set it = null
   endif

   if g == 6 then
      set str = "Pickup to Extended Inventory: |cffffcc00" + fs_iif(get_object_iparam(u, "inv100_auto_pickup") == 1, "ON", "OFF") + "|r"
   elseif g == 2 then
      set str = "Return to Game (|cffffcc00ESC|r)"
   elseif g == 3 then
      set str = fs_iif(get_session_iparam("selected_cell") != -1 and IsItemSellable(it), "Sell Item", " ")
   elseif g == 4 then
      set str = fs_iif(get_session_iparam("selected_cell") != -1 and GetItemCharges(it) > 0, "Use Item", " ")
   elseif g == 5 then
      set str = fs_iif(get_session_iparam("selected_cell") != -1, "Drop Item", " ")
   else
      set str = " "
   endif
   call fs_SetNamedTextTagText("button_label", str, 0)


   if GetItemTypeId(it) != 0 then
      call fs_SetNamedTextTagText("item_name", inv100_GetItemName(GetItemTypeId(it)), 0)
      call fs_SetNamedTextTagText("item_desc", inv100_GetItemDesc(GetItemTypeId(it)), 0)
   else
      call fs_SetNamedTextTagText("item_name", " ", 0)
      call fs_SetNamedTextTagText("item_desc", " ", 0)
   endif

   if IsItemSellable(it) then
      call fs_AddNamedEffectXY("cost", "cost", 185, 885, false)
      call fs_SetNamedTextTagText("item_cost", "|cffffcc00" + I2S(inv100_GetItemCost(GetItemTypeId(it))) + "|r", 0)
   else
      call fs_AddNamedEffectXY("cost", "", 0, 0, false)
      call fs_SetNamedTextTagText("item_cost", " ", 0)
   endif

endfunction



//################################################################################
function inv100_PlayCineFilter takes nothing returns nothing
   if cfgi("inv100_fadefilter") == 0 then
      return
   endif
   if Player(fs_GetPlayerID()) != GetLocalPlayer() then
      return
   endif
   call SetCineFilterTexture("ReplaceableTextures\\CameraMasks\\Black_mask.blp")
   call SetCineFilterStartColor(0, 0, 0, 255)
   call SetCineFilterEndColor(0, 0, 0, 0)
   call SetCineFilterDuration(1.00)
   call DisplayCineFilter(true)
endfunction

//################################################################################
function inv100_DetectShop takes nothing returns nothing
   if GetUnitAbilityLevel(GetEnumUnit(), 'Apit') >= 1 then
      call set_session_iparam("allow_sell", 1)
   endif
endfunction


//################################################################################
function inv100_Init takes nothing returns nothing
   local integer i
   local integer tid
   local unit u = GetTriggerUnit()
   local integer rows
   local integer cols
   local integer x = 0
   local integer y = 0
   local item it
   local group gr

   call set_session_iparam("unit", fs_H2I(u))
   call set_session_iparam("selected_cell", -1)
   call set_session_iparam("selected_item", 0)

   call PauseUnit(u, true)

// ####### validate dimensions #######

   set rows = get_object_iparam(u, "inv100_rows")
   set cols = get_object_iparam(u, "inv100_cols")
   if rows == 0 or cols == 0 then
      set rows = cfgi("inv100_default_rows")
      set cols = cfgi("inv100_default_cols")
   endif
   call inv100_SetInventorySize(u, rows, cols)
   set rows = get_object_iparam(u, "inv100_rows")
   set cols = get_object_iparam(u, "inv100_cols")

// ####### detect nearby shop to allow sell mode #######

   call set_session_iparam("allow_sell", 0)

   if cfgi("inv100_sell_mode") == 1 then
      set gr = CreateGroup()
      call GroupEnumUnitsInRange(gr, GetUnitX(u), GetUnitY(u), cfgr("inv100_sell_range"), null)
      call ForGroup(gr, function inv100_DetectShop)
      call DestroyGroup(gr)   
   elseif cfgi("inv100_sell_mode") == 2 then
      call set_session_iparam("allow_sell", 1)
   endif


// ####### attach auto-pickup trigger #######

   if get_object_iparam(u, "inv100_enabled") == 0 then
      call TriggerRegisterUnitEvent( fs_I2T(cfgi("inv100_exit_trigger")), u, EVENT_UNIT_DEATH )
      call TriggerRegisterUnitEvent( fs_I2T(cfgi("inv100_pickup_trigger")), u, EVENT_UNIT_PICKUP_ITEM )
      call set_object_iparam(u, "inv100_enabled", 1)
   endif


// ####### small inventory #######


   call fs_AddBackgroundEffect("cornerUL", fs_Coords2Id(1, 6), true)
   call fs_AddBackgroundEffect("cornerUR", fs_Coords2Id(2, 6), true)
   call fs_AddBackgroundEffect("borderL" , fs_Coords2Id(1, 7), true)
   call fs_AddBackgroundEffect("borderR" , fs_Coords2Id(2, 7), true)
   call fs_AddBackgroundEffect("cornerDL", fs_Coords2Id(1, 8), true)
   call fs_AddBackgroundEffect("cornerDR", fs_Coords2Id(2, 8), true)

   set i = 0
   loop
      exitwhen i >= 6
      set x = ModuloInteger(i, 2) + 1
      set y = i / 2 + 6
      set tid  = fs_Coords2Id(x, y)

      call fs_SetTrackableGroup(tid, 0)
      call fs_AddBackgroundEffect("central", tid, true)
      call inv100_DrawItem(tid, UnitItemInSlot(u, i))

      set i = i + 1
   endloop


// ####### large inventory #######

   call fs_AddBackgroundEffect("cornerUL", fs_Coords2Id(9, 0), true)
   call fs_AddBackgroundEffect("cornerUR", fs_Coords2Id(8 + cols, 0), true)
   call fs_AddBackgroundEffect("cornerDL", fs_Coords2Id(9, rows - 1), true)
   call fs_AddBackgroundEffect("cornerDR", fs_Coords2Id(8 + cols, rows - 1), true)



   set y = 0
   loop
      exitwhen y >= rows
      set x = 0
      loop
         exitwhen x >= cols
         set tid  = fs_Coords2Id(x + 9, y)
         call fs_SetTrackableGroup(tid, 1)
         call fs_AddBackgroundEffect("central", tid, true)

         set it = inv100_UnitItemInSlot(u, y * cols + x)

         if GetItemTypeId(it) == 0 or IsItemOwned(it) or RectContainsItem(it, bj_mapInitialPlayableArea) then
            call set_object_iparam(u, "inv100_item" + I2S(y * cols + x), 0)
            set it = null
         endif

         call inv100_DrawItem(tid, it)

         set x = x + 1
      endloop
      set y = y + 1
   endloop
   call set_object_iparam(u, "inv100_item-1", 0)


   set y = 1
   loop
      exitwhen y >= rows - 1
      call fs_AddBackgroundEffect("borderL" , fs_Coords2Id(9, y), true)
      call fs_AddBackgroundEffect("borderR" , fs_Coords2Id(8 + cols, y), true)
      set y = y + 1
   endloop

   set x = 1
   loop
      exitwhen x >= cols - 1
      call fs_AddBackgroundEffect("borderU" , fs_Coords2Id(x + 9, 0), true)
      call fs_AddBackgroundEffect("borderD" , fs_Coords2Id(x + 9, rows - 1), true)
      set x = x + 1
   endloop



// ####### description box #######


   call fs_AddBackgroundEffect("description", fs_Coords2Id(4, 1), true)

   call fs_AddBackgroundEffect("cornerUL", fs_Coords2Id(1, 0), true)
   call fs_AddBackgroundEffect("borderL" , fs_Coords2Id(1, 1), true)
   call fs_AddBackgroundEffect("cornerDL", fs_Coords2Id(1, 2), true)

   call fs_AddBackgroundEffect("cornerUR", fs_Coords2Id(6, 0), true)
   call fs_AddBackgroundEffect("borderR" , fs_Coords2Id(6, 1), true)
   call fs_AddBackgroundEffect("cornerDR", fs_Coords2Id(6, 2), true)

   call fs_AddBackgroundEffect("borderU" , fs_Coords2Id(2, 0), true)
   call fs_AddBackgroundEffect("borderU" , fs_Coords2Id(3, 0), true)
   call fs_AddBackgroundEffect("borderU" , fs_Coords2Id(4, 0), true)
   call fs_AddBackgroundEffect("borderU" , fs_Coords2Id(5, 0), true)

   call fs_AddBackgroundEffect("borderD" , fs_Coords2Id(2, 2), true)
   call fs_AddBackgroundEffect("borderD" , fs_Coords2Id(3, 2), true)
   call fs_AddBackgroundEffect("borderD" , fs_Coords2Id(4, 2), true)
   call fs_AddBackgroundEffect("borderD" , fs_Coords2Id(5, 2), true)


// ####### buttons #######

   set x = 1
   set y = 4

   call fs_AddBackgroundEffect("cornerUL", fs_Coords2Id(x, y), true)
   call fs_AddBackgroundEffect("cornerDL", fs_Coords2Id(x, y), true)
   call fs_AddBackgroundEffect("central" , fs_Coords2Id(x, y), true)
   call fs_SetTrackableGroup(fs_Coords2Id(x, y), 2)
   call fs_AddNamedEffect("button_exit", "BTNExit", fs_Coords2Id(x, y), false)

   set x = x + 1

   if get_session_iparam("allow_sell") == 1 then
      call fs_AddBackgroundEffect("borderU" , fs_Coords2Id(x, y), true)
      call fs_AddBackgroundEffect("borderD" , fs_Coords2Id(x, y), true)
      call fs_AddBackgroundEffect("central" , fs_Coords2Id(x, y), true)
      call fs_SetTrackableGroup(fs_Coords2Id(x, y), 3)
      call fs_AddNamedEffect("button_sell", "DISBTNSell", fs_Coords2Id(x, y), false)
      call set_session_iparam("button_sell_pos", fs_Coords2Id(x, y))
      set x = x + 1
   else
      call set_session_iparam("button_sell_pos", -1)
   endif

   if cfgi("inv100_allow_use") == 1 then
      call fs_AddBackgroundEffect("borderU" , fs_Coords2Id(x, y), true)
      call fs_AddBackgroundEffect("borderD" , fs_Coords2Id(x, y), true)
      call fs_AddBackgroundEffect("central" , fs_Coords2Id(x, y), true)
      call fs_SetTrackableGroup(fs_Coords2Id(x, y), 4)
      call fs_AddNamedEffect("button_use" , "DISBTNUse" , fs_Coords2Id(x, y), false)
      call set_session_iparam("button_use_pos", fs_Coords2Id(x, y))
      set x = x + 1
   else
      call set_session_iparam("button_use_pos", -1)
   endif

   if cfgi("inv100_allow_drop") == 1 then
      call fs_AddBackgroundEffect("borderU" , fs_Coords2Id(x, y), true)
      call fs_AddBackgroundEffect("borderD" , fs_Coords2Id(x, y), true)
      call fs_AddBackgroundEffect("central" , fs_Coords2Id(x, y), true)
      call fs_SetTrackableGroup(fs_Coords2Id(x, y), 5)
      call fs_AddNamedEffect("button_drop" , "DISBTNDrop" , fs_Coords2Id(x, y), false)
      call set_session_iparam("button_drop_pos", fs_Coords2Id(x, y))
      set x = x + 1
   else
      call set_session_iparam("button_drop_pos", -1)
   endif

   call fs_AddBackgroundEffect("cornerUR", fs_Coords2Id(x, y), true)
   call fs_AddBackgroundEffect("cornerDR", fs_Coords2Id(x, y), true)
   call fs_AddBackgroundEffect("central" , fs_Coords2Id(x, y), true)
   call fs_SetTrackableGroup(fs_Coords2Id(x, y), 6)
   call fs_AddNamedEffect("button_pickup", "BTNAutoPickup", fs_Coords2Id(x, y), false)
   call set_session_iparam("button_pickup_pos", fs_Coords2Id(x, y))
   if get_object_iparam(u, "inv100_auto_pickup") == 1 then
      call fs_AddNamedEffect("button_pickup_selected", "selector", fs_Coords2Id(x, y), false)
   endif



   call fs_AddNamedTextTag("button_label", 380, 400 , " ", 0)

   call fs_AddNamedTextTag("item_hint", 150, 720, " ", 0)
   call fs_AddNamedTextTag("item_desc", 150, 774, " ", 0)
   call fs_AddNamedTextTag("item_cost", 185, 874, " ", 0)
   call fs_AddNamedTextTag("item_name", 150, 924, " ", 0)


   call fs_PlaySound("Sound\\Interface\\RightGlueScreenPopDown.wav")
   call inv100_PlayCineFilter()
//   call dbg("player " + cfg("player") + " entered inventory")
endfunction


//################################################################################
function inv100_Exit takes nothing returns nothing
   call inv100_PlayCineFilter()
   call fs_PlaySound("Sound\\Interface\\RightGlueScreenPopUp.wav")
   call PauseUnit(fs_I2U(get_session_iparam("unit")), false)
   if cfgi("inv100_lock_cam") == 1 then
      call SetCameraTargetControllerNoZForPlayer(Player(fs_GetPlayerID()), fs_I2U(get_session_iparam("unit")), 0, 0, false)
   endif
//   call dbg("player " + cfg("player") + " exited inventory")
endfunction




//################################################################################
function inv100_SaveToCache takes gamecache cache, string missionkey, string label, unit u returns nothing
   local integer i = 0
   local integer rows = get_object_iparam(u, "inv100_rows")
   local integer cols = get_object_iparam(u, "inv100_cols")
   call StoreBoolean(cache, missionkey, label + "_inventory", true)
   call StoreInteger(cache, missionkey, label + "_rows", rows)
   call StoreInteger(cache, missionkey, label + "_cols", cols)
   call StoreInteger(cache, missionkey, label + "_auto_pickup", get_object_iparam(u, "inv100_auto_pickup"))
   loop
      exitwhen i >= rows * cols
      call StoreInteger(cache, missionkey, label + "_item" + I2S(i), GetItemTypeId(inv100_UnitItemInSlot(u, i)))
      call StoreInteger(cache, missionkey, label + "_charges" + I2S(i), GetItemCharges(inv100_UnitItemInSlot(u, i)))
      set i = i + 1
   endloop
//   call dbg("saved label '" + label + "'...")
endfunction


//################################################################################
function inv100_LoadFromCache takes gamecache cache, string missionkey, string label, unit u returns nothing
   local integer i = 0
   local integer rows = GetStoredInteger(cache, missionkey, label + "_rows")
   local integer cols = GetStoredInteger(cache, missionkey, label + "_cols")
   local item it
   if not HaveStoredBoolean(cache, missionkey, label + "_inventory") then
      return
   endif
   call inv100_SetInventorySize(u, rows, cols)
   set rows = get_object_iparam(u, "inv100_rows")
   set cols = get_object_iparam(u, "inv100_cols")
   call set_object_iparam(u, "inv100_auto_pickup", GetStoredInteger(cache, missionkey, label + "_auto_pickup"))
   loop
      exitwhen i >= rows * cols
      call RemoveItem(inv100_UnitItemInSlot(u, i))
      if GetStoredInteger(cache, missionkey, label + "_item" + I2S(i)) != 0 then
         set it = CreateItem(GetStoredInteger(cache, missionkey, label + "_item" + I2S(i)), 0, 0)
         call SetItemCharges(it, GetStoredInteger(cache, missionkey, label + "_charges" + I2S(i)))
         call inv100_UnitAddItemToSlot(u, it, i)
      endif
      set i = i + 1
   endloop
   if get_object_iparam(u, "inv100_enabled") == 0 then
      call TriggerRegisterUnitEvent( fs_I2T(cfgi("inv100_pickup_trigger")), u, EVENT_UNIT_PICKUP_ITEM )
      call set_object_iparam(u, "inv100_enabled", 1)
   endif
//   call dbg("loaded label '" + label + "'...")
endfunction


//################################################################################
function inv100_AutoPickupAction takes nothing returns nothing
   local integer i = 0
   local unit u = GetTriggerUnit()
   local integer p = GetPlayerId(GetOwningPlayer(u))
   local integer slots = get_object_iparam(u, "inv100_rows") * get_object_iparam(u, "inv100_cols")

   call setcfg("player", I2S(GetPlayerId(GetOwningPlayer(u))))

   if IsItemPowerup(GetManipulatedItem()) or get_session_iparam("fs_enabled") == 1 or get_object_iparam(u, "inv100_auto_pickup") == 0 then
      return
   endif

   loop
      exitwhen i >= slots
      if GetItemTypeId(inv100_UnitItemInSlot(u, i)) == 0 then
         call inv100_UnitAddItemToSlot(u, GetManipulatedItem(), i)
         return
      endif
      set i = i + 1
   endloop
endfunction


//################################################################################
function inv100_ExitEscapeAction takes nothing returns nothing
   if cfgi("inv100_allow_escape") == 1 then
      call fs_Shutdown(GetPlayerId(GetTriggerPlayer()))
   endif
endfunction

//################################################################################
function inv100_ExitOnDeathAction takes nothing returns nothing
   local integer p = GetPlayerId(GetOwningPlayer(GetDyingUnit()))
   call setcfg("player", I2S(p))
   if get_session_iparam("unit") == fs_H2I(GetDyingUnit()) then
      call fs_Shutdown(p)
   endif
endfunction

//################################################################################
function inv100_EnterAction takes nothing returns nothing
    if GetSpellAbilityId() != cfgi("inv100_ability") then
       return
    endif
    
    call IssueImmediateOrderBJ( GetTriggerUnit(), "stop" )
    call TriggerSleepAction( 0.00 )
    call fs_LoadModule(GetPlayerId(GetOwningPlayer(GetTriggerUnit())), "inv100")
endfunction


//################################################################################
function InitTrig_inventory_module takes nothing returns nothing
   local trigger t
   local integer i = 0

   set t = CreateTrigger()
   call TriggerAddAction(t, function inv100_AutoPickupAction)
   call setcfg("inv100_pickup_trigger", I2S(fs_H2I(t)))

   set t = CreateTrigger()
   call TriggerAddAction(t, function inv100_ExitOnDeathAction)
   call setcfg("inv100_exit_trigger", I2S(fs_H2I(t)))

   set t = CreateTrigger()
   call TriggerAddAction(t, function inv100_ExitEscapeAction)
   loop
      exitwhen i >= 12
      call TriggerRegisterPlayerEventEndCinematic(t, Player(i))
      set i = i + 1
   endloop

   set t = CreateTrigger()
   call TriggerAddAction(t, function inv100_EnterAction)
   call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_CHANNEL)
endfunction
 

Vulcansurge

Ultra Cool Member
Reaction score
27
ITEM SETTINGS:

Code:
//################################################################################
function inv100_RegisterItem takes integer i, integer did, string name, string desc, integer cost returns nothing
   call StoreString(udg_fs_cache, I2S(i), "name", name)
   call StoreString(udg_fs_cache, I2S(i), "desc", desc)
   call StoreInteger(udg_fs_cache,I2S(i), "cost", cost)
   call fs_RegisterEffect(did, "inv100_item" + I2S(i))
endfunction

//################################################################################
function InitTrig_inventory_init_item_settings takes nothing returns nothing
//################################################################################
//
// To add your custom items, do the following:
//
// 1. Go to Destructibles tab in Object Editor, open "Custom Destructibles" section
// 2. Copy and paste any of the "inv100_IconXXX" objects, then change the 
//    "Art - Replaceable Texture File" field to the path to your item icon
//    (make sure you've imported icon itself :))
// 3. Copy and uncomment the example line below this comment block
//    replace:
//        'I000' with code of your item  (press Ctrl+D in Object Editor to view codes)
//        'B000' with code of destructible you created on step 2
//        "Name" and "Description" with those of your item
//        100    with gold cost of your item
// 4. Repeat steps 1-3 for each custom item you have.
//
//################################################################################
// data for custom items
//################################################################################


//call inv100_RegisterItem('l001:frgd', 'B000', "Mithril Sword", "A sword crafted by a local blacksmith, adds 10dmg", 500)


//################################################################################
// data for standard items
// based on ItemStrings.txt, ItemFunc.txt & ItemData.slk v1.18 (274 items total)
//################################################################################

call inv100_RegisterItem('amrc', 'BI00', "Amulet of Recall", "Can be used to teleport units to the user.", 250)
call inv100_RegisterItem('ankh', 'BI01', "Ankh of Reincarnation", "Allows reincarnation upon death.", 800)
call inv100_RegisterItem('belv', 'BI02', "Boots of Quel'Thalas +6", "Provides a bonus to Agility.", 500)
call inv100_RegisterItem('bgst', 'BI03', "Belt of Giant Strength +6", "Provides a bonus to Strength.", 500)
call inv100_RegisterItem('bspd', 'BI04', "Boots of Speed", "Increases movement rate.", 250)
call inv100_RegisterItem('ccmd', 'BI05', "Scepter of Mastery", "Allows mind control of non-Hero units.", 1000)
call inv100_RegisterItem('ciri', 'BI06', "Robe of the Magi +6", "Provides a bonus to Intelligence.", 500)
call inv100_RegisterItem('ckng', 'BI07', "Crown of Kings +5", "Provides a +5 bonus to Agility, Strength, and Intelligence.", 1000)
call inv100_RegisterItem('clsd', 'BI08', "Cloak of Shadows", "Provides the Shadowmeld ability.", 100)
call inv100_RegisterItem('crys', 'BI09', "Crystal Ball", "Permits the viewing of distant areas.", 500)
call inv100_RegisterItem('desc', 'BI10', "Kelen's Dagger of Escape", "Teleports the Hero a short distance.", 400)
call inv100_RegisterItem('flag', 'BI11', "Human Flag", "Can be captured in special scenarios.", 1000)
call inv100_RegisterItem('nflg', 'BI12', "Night Elf Flag", "Can be captured in special scenarios.", 1000)
call inv100_RegisterItem('oflg', 'BI13', "Orc Flag", "Can be captured in special scenarios.", 1000)
call inv100_RegisterItem('uflg', 'BI14', "Undead Flag", "Can be captured in special scenarios.", 1000)
call inv100_RegisterItem('gemt', 'BI15', "Gem of True Seeing", "Permits invisible units to be seen.", 200)
call inv100_RegisterItem('gobm', 'BI16', "Goblin Land Mines", "Explosive mines.", 225)
call inv100_RegisterItem('gsou', 'BI17', "Soul Gem", "Allows the theft of a Hero's soul.", 1000)
call inv100_RegisterItem('guvi', 'BI18', "Glyph of Ultravision", "Improves night vision.", 125)
call inv100_RegisterItem('gfor', 'BI19', "Glyph of Fortification", "Improves building armor and hit points.", 200)
call inv100_RegisterItem('soul', 'BI20', "Soul", "This is a trapped soul.", 1000)
call inv100_RegisterItem('mdpb', 'BI21', "Medusa Pebble", "Turns target unit to stone.", 0)
call inv100_RegisterItem('rag1', 'BI22', "Slippers of Agility +3", "Boosts Agility by 3.", 100)
call inv100_RegisterItem('rat3', 'BI23', "Claws of Attack +3", "Boosts attack damage by 3.", 50)
call inv100_RegisterItem('rin1', 'BI24', "Mantle of Intelligence +3", "Boosts Intelligence by 3.", 100)
call inv100_RegisterItem('rde1', 'BI25', "Ring of Protection +2", "Boosts armor by 2.", 150)
call inv100_RegisterItem('rde2', 'BI26', "Ring of Protection +3", "Boosts armor by 3.", 400)
call inv100_RegisterItem('rde3', 'BI27', "Ring of Protection +4", "Boosts armor by 4.", 500)
call inv100_RegisterItem('rhth', 'BI28', "Khadgar's Gem of Health", "Increases the hit points of the Hero.", 500)
call inv100_RegisterItem('rst1', 'BI29', "Gauntlets of Ogre Strength +3", "Boosts Strength by 3.", 100)
call inv100_RegisterItem('ofir', 'BI30', "Orb of Fire", "Attacks also do fire damage.", 275)
call inv100_RegisterItem('ofro', 'BI31', "Orb of Frost", "Attacks cause Frost Shock.", 800)
call inv100_RegisterItem('olig', 'BI32', "Orb of Lightning", "Attacks cause lightning damage.", 450)
call inv100_RegisterItem('oli2', 'BI33', "Orb of Lightning", "Attacks cause lightning damage.", 375)
call inv100_RegisterItem('oven', 'BI34', "Orb of Venom", "Attacks cause poison damage.", 325)
call inv100_RegisterItem('odef', 'BI35', "Orb of Darkness", "Attacks can create Dark Minions.", 500)
call inv100_RegisterItem('ocor', 'BI36', "Orb of Corruption", "Attacks reduce armor.", 375)
call inv100_RegisterItem('pdiv', 'BI37', "Potion of Divinity", "Turns Hero invulnerable.", 600)
call inv100_RegisterItem('phea', 'BI38', "Potion of Healing", "Restores lost hit points.", 150)
call inv100_RegisterItem('pghe', 'BI39', "Potion of Greater Healing", "Restores lost hit points.", 400)
call inv100_RegisterItem('pinv', 'BI40', "Potion of Invisibility", "Renders Hero temporarily invisible.", 100)
call inv100_RegisterItem('pgin', 'BI41', "Potion of Greater Invisibility", "Renders Hero temporarily invisible.", 200)
call inv100_RegisterItem('pman', 'BI42', "Potion of Mana", "Restores lost mana.", 200)
call inv100_RegisterItem('pgma', 'BI43', "Potion of Greater Mana", "Restores lost mana.", 400)
call inv100_RegisterItem('pnvu', 'BI44', "Potion of Invulnerability", "Renders Hero temporarily invulnerable.", 400)
call inv100_RegisterItem('pnvl', 'BI45', "Potion of Lesser Invulnerability", "Renders Hero temporarily invulnerable.", 150)
call inv100_RegisterItem('pres', 'BI46', "Potion of Restoration", "Restores lost hit points and mana.", 600)
call inv100_RegisterItem('pspd', 'BI47', "Potion of Speed", "Provides Hero with a temporary speed increase.", 75)
call inv100_RegisterItem('rlif', 'BI48', "Ring of Regeneration", "Provides regeneration.", 200)
call inv100_RegisterItem('rwiz', 'BI49', "Sobi Mask", "Increases mana regeneration rate.", 400)
call inv100_RegisterItem('sfog', 'BI50', "Horn of the Clouds", "Stops enemy towers from attacking.", 200)
call inv100_RegisterItem('rhe1', 'BI51', "Rune of Lesser Healing", "Restores hit points to nearby units.", 100)
call inv100_RegisterItem('rhe2', 'BI52', "Rune of Healing", "Restores hit points to nearby units.", 200)
call inv100_RegisterItem('rhe3', 'BI53', "Rune of Greater Healing", "Restores hit points to nearby units.", 300)
call inv100_RegisterItem('shea', 'BI54', "Scroll of Healing", "Restores hit points to nearby units.", 250)
call inv100_RegisterItem('sman', 'BI55', "Scroll of Mana", "Restores mana to nearby units.", 150)
call inv100_RegisterItem('rman', 'BI56', "Rune of Mana", "Restores mana to nearby units.", 100)
call inv100_RegisterItem('rma2', 'BI57', "Rune of Greater Mana", "Restores mana to nearby units.", 300)
call inv100_RegisterItem('spro', 'BI58', "Scroll of Protection", "Temporarily increases the armor of nearby units.", 150)
call inv100_RegisterItem('sres', 'BI59', "Scroll of Restoration", "Restores hit points and mana to nearby units.", 750)
call inv100_RegisterItem('rres', 'BI60', "Rune of Restoration", "Restores hit points and mana to nearby units.", 250)
call inv100_RegisterItem('ssil', 'BI61', "Staff of Silence", "Stops enemy spellcasting.", 500)
call inv100_RegisterItem('stwp', 'BI62', "Scroll of Town Portal", "Transports troops to friendly town hall.", 350)
call inv100_RegisterItem('tels', 'BI63', "Goblin Night Scope", "Increases sight range at night.", 200)
call inv100_RegisterItem('tdex', 'BI64', "Tome of Agility", "Permanently increases Agility.", 150)
call inv100_RegisterItem('texp', 'BI65', "Tome of Experience", "Gives bonus experience points.", 500)
call inv100_RegisterItem('tint', 'BI66', "Tome of Intelligence", "Permanently increases Intelligence.", 150)
call inv100_RegisterItem('tkno', 'BI67', "Tome of Power", "Gives the Hero an experience level.", 1250)
call inv100_RegisterItem('tstr', 'BI68', "Tome of Strength", "Permanently increases Strength.", 150)
call inv100_RegisterItem('ward', 'BI69', "Warsong Battle Drums", "Increases combat effectiveness of nearby units.", 500)
call inv100_RegisterItem('will', 'BI70', "Wand of Illusion", "Creates a phantom double.", 150)
call inv100_RegisterItem('wneg', 'BI71', "Wand of Negation", "Dispels magic in an area.", 200)
call inv100_RegisterItem('rdis', 'BI72', "Rune of Dispel Magic", "Dispels magic in the surrounding area.", 75)
call inv100_RegisterItem('rwat', 'BI73', "Rune of the Watcher", "Creates an invulnerable Sentry Ward here.", 75)
call inv100_RegisterItem('fgrd', 'BI74', "Red Drake Egg", "Summons a Red Drake.", 450)
call inv100_RegisterItem('fgrg', 'BI75', "Stone Token", "Summons a Rock Golem.", 450)
call inv100_RegisterItem('fgdg', 'BI76', "Demonic Figurine", "Summons a Doom Guard.", 750)
call inv100_RegisterItem('fgfh', 'BI77', "Spiked Collar", "Summons a Fel Stalker.", 450)
call inv100_RegisterItem('fgsk', 'BI78', "Book of the Dead", "Summons skeletons.", 450)
call inv100_RegisterItem('ktrm', 'BI79', "Urn of King Terenas", "This urn contains the remains of King Terenas.", 200)
call inv100_RegisterItem('sehr', 'BI80', "The Heart of Searinox", "The heart of the Dragon Searinox.", 200)
call inv100_RegisterItem('azhr', 'BI81', "Heart of Aszune", "The magical amulet Heart of Aszune.", 200)
call inv100_RegisterItem('bzbe', 'BI82', "Empty Vial", "This is an empty vial.", 200)
call inv100_RegisterItem('bzbf', 'BI83', "Full Vial", "This vial is full of healing waters.", 200)
call inv100_RegisterItem('cnhn', 'BI84', "Horn of Cenarius", "This is the Horn of Cenarius.", 200)
call inv100_RegisterItem('glsk', 'BI85', "Skull of Gul'dan", "This is the Skull of Gul'dan.", 200)
call inv100_RegisterItem('engs', 'BI86', "Enchanted Gemstone", "This is an enchanted gemstone.", 200)
call inv100_RegisterItem('k3m1', 'BI87', "Mooncrystal", "This is one part of the Key of Three Moons.", 200)
call inv100_RegisterItem('k3m2', 'BI88', "Partial Key of the Three Moons", "This is two parts of the Key of Three Moons.", 200)
call inv100_RegisterItem('k3m3', 'BI89', "Key of Three Moons", "This is the complete Key of Three Moons.", 200)
call inv100_RegisterItem('modt', 'BI90', "Mask of Death", "This mask causes the Hero's attacks to drain life.", 1000)
call inv100_RegisterItem('sand', 'BI91', "Scroll of Animate Dead", "Animates the dead to fight for you.", 750)
call inv100_RegisterItem('srrc', 'BI92', "Scroll of Resurrection", "Resurrects your dead to fight again.", 750)
call inv100_RegisterItem('rre1', 'BI93', "Rune of Lesser Resurrection", "Resurrects your dead to fight again.", 100)
call inv100_RegisterItem('rre2', 'BI94', "Rune of Greater Resurrection", "Resurrects your dead to fight again.", 300)
call inv100_RegisterItem('rspl', 'BI95', "Rune of Spirit Link", "Links units together to distribute damage.", 150)
call inv100_RegisterItem('sror', 'BI96', "Scroll of the Beast", "Boosts friendly unit combat damage.", 400)
call inv100_RegisterItem('infs', 'BI97', "Inferno Stone", "Brings down an Infernal Demon.", 750)
call inv100_RegisterItem('shar', 'BI98', "Ice Shard", "Summons an Ice Revenant.", 750)
call inv100_RegisterItem('wild', 'BI99', "Amulet of the Wild", "Summons a Furbolg.", 750)
call inv100_RegisterItem('wswd', 'BJ00', "Sentry Wards", "Conjures a Sentry Ward.", 150)
call inv100_RegisterItem('whwd', 'BJ01', "Healing Wards", "Conjures a Healing Ward.", 600)
call inv100_RegisterItem('wlsd', 'BJ02', "Wand of Lightning Shield", "Casts Lightning Shield.", 150)
call inv100_RegisterItem('wcyc', 'BJ03', "Wand of the Wind", "Casts Cyclone.", 450)
call inv100_RegisterItem('rnec', 'BJ04', "Rod of Necromancy", "Creates two Skeleton Warriors from a corpse.", 150)
call inv100_RegisterItem('pams', 'BJ05', "Anti-magic Potion", "Renders Hero immune to magic.", 100)
call inv100_RegisterItem('clfm', 'BJ06', "Cloak of Flames", "Surrounds the Hero with damaging flames.", 600)
call inv100_RegisterItem('evtl', 'BJ07', "Talisman of Evasion", "Makes the Hero harder to hit.", 400)
call inv100_RegisterItem('nspi', 'BJ08', "Necklace of Spell Immunity", "Grants immunity to magic.", 1000)
call inv100_RegisterItem('lhst', 'BJ09', "The Lion Horn of Stormwind", "Generates a protective aura around the Hero.", 400)
call inv100_RegisterItem('kpin', 'BJ10', "Khadgar's Pipe of Insight", "Nearby units regain mana more swiftly.", 500)
call inv100_RegisterItem('sbch', 'BJ11', "Scourge Bone Chimes", "Nearby units gain some life from damage they deal to enemy units.", 450)
call inv100_RegisterItem('afac', 'BJ12', "Alleria's Flute of Accuracy", "Nearby units' missile attacks do more damage.", 400)
call inv100_RegisterItem('ajen', 'BJ13', "Ancient Janggo of Endurance", "Nearby units move and attack more swiftly.", 500)
call inv100_RegisterItem('lgdh', 'BJ14', "Legion Doom-Horn", "Nearby units heal and move more swiftly.", 400)
call inv100_RegisterItem('hcun', 'BJ15', "Hood of Cunning", "Provides bonuses to Agility and Intelligence.", 500)
call inv100_RegisterItem('mcou', 'BJ16', "Medallion of Courage", "Provides bonuses to Strength and Intelligence.", 500)
call inv100_RegisterItem('hval', 'BJ17', "Helm of Valor", "Provides bonuses to Strength and Agility.", 500)
call inv100_RegisterItem('cnob', 'BJ18', "Circlet of Nobility", "Provides a +2 bonus to Strength, Agility and Intelligence.", 175)
call inv100_RegisterItem('prvt', 'BJ19', "Periapt of Vitality", "Increases the hit points of the Hero.", 350)
call inv100_RegisterItem('tgxp', 'BJ20', "Tome of Greater Experience", "Gives bonus experience points.", 1000)
call inv100_RegisterItem('mnst', 'BJ21', "Mana Stone", "Provides faster mana regeneration, and can be consumed for mana.", 450)
call inv100_RegisterItem('hlst', 'BJ22', "Health Stone", "Provides faster regeneration, and can be consumed for hit points.", 450)
call inv100_RegisterItem('tpow', 'BJ23', "Tome of Knowledge", "Permanently increases Strength, Agility and Intelligence.", 300)
call inv100_RegisterItem('tst2', 'BJ24', "Tome of Strength +2", "Permanently increases Strength.", 300)
call inv100_RegisterItem('tin2', 'BJ25', "Tome of Intelligence +2", "Permanently increases Intelligence.", 300)
call inv100_RegisterItem('tdx2', 'BJ26', "Tome of Agility +2", "Permanently increases Agility.", 300)
call inv100_RegisterItem('rde0', 'BJ27', "Ring of Protection +1", "Boosts armor by 1.", 50)
call inv100_RegisterItem('rde4', 'BJ28', "Ring of Protection +5", "Boosts armor by 5.", 800)
call inv100_RegisterItem('rat6', 'BJ29', "Claws of Attack +6", "Boosts attack damage by 6.", 100)
call inv100_RegisterItem('rat9', 'BJ30', "Claws of Attack +9", "Boosts attack damage by 9.", 400)
call inv100_RegisterItem('ratc', 'BJ31', "Claws of Attack +12", "Boosts attack damage by 12.", 500)
call inv100_RegisterItem('ratf', 'BJ32', "Claws of Attack +15", "Boosts attack damage by 15.", 800)
call inv100_RegisterItem('manh', 'BJ33', "Manual of Health", "Permanent +50 hit points.", 200)
call inv100_RegisterItem('pmna', 'BJ34', "Pendant of Mana", "Provides additional mana.", 500)
call inv100_RegisterItem('penr', 'BJ35', "Pendant of Energy", "Provides additional mana.", 400)
call inv100_RegisterItem('gcel', 'BJ36', "Gloves of Haste", "Increases attack speed.", 100)
call inv100_RegisterItem('ledg', 'BJ37', "Gerard's Lost Ledger", "A ledger.", 200)
call inv100_RegisterItem('totw', 'BJ38', "Talisman of the Wild", "Summons Furbolgs.", 450)
call inv100_RegisterItem('kybl', 'BJ39', "Blood Key", "A bloody key.", 200)
call inv100_RegisterItem('kygh', 'BJ40', "Ghost Key", "A ghostly key.", 200)
call inv100_RegisterItem('kysn', 'BJ41', "Sun Key", "A glowing key.", 200)
call inv100_RegisterItem('kymn', 'BJ42', "Moon Key", "A faintly glowing key.", 200)
call inv100_RegisterItem('phlt', 'BJ43', "Phat Lewt", "The phattest lewt, definitely.", 500)
call inv100_RegisterItem('gopr', 'BJ44', "Glyph of Purification", "A glyph.", 250)
call inv100_RegisterItem('ches', 'BJ45', "Cheese", "It's the Cheese!", 250)
call inv100_RegisterItem('mlst', 'BJ46', "Maul of Strength", "Boosts Strength by 1.", 50)
call inv100_RegisterItem('rnsp', 'BJ47', "Ring of Superiority", "Provides a +1 bonus to Strength, Agility and Intelligence.", 100)
call inv100_RegisterItem('brag', 'BJ48', "Bracer of Agility", "Boosts Agility by 1.", 50)
call inv100_RegisterItem('sksh', 'BJ49', "Skull Shield", "Boosts Strength by 1.", 200)
call inv100_RegisterItem('vddl', 'BJ50', "Voodoo Doll", "Boosts Intelligence by 1.", 50)
call inv100_RegisterItem('sprn', 'BJ51', "Spider Ring", "Boosts Agility by 1.", 50)
call inv100_RegisterItem('tmmt', 'BJ52', "Totem of Might", "Boosts Strength by 1.", 50)
call inv100_RegisterItem('anfg', 'BJ53', "Ancient Figurine", "Boosts Intelligence by 1.", 150)
call inv100_RegisterItem('lnrn', 'BJ54', "Lion's Ring", "Boosts Agility by 1.", 50)
call inv100_RegisterItem('iwbr', 'BJ55', "Ironwood Branch", "Boosts Strength by 1.", 50)
call inv100_RegisterItem('jdrn', 'BJ56', "Jade Ring", "Boosts Agility by 1.", 50)
call inv100_RegisterItem('drph', 'BJ57', "Druid Pouch", "Boosts Intelligence by 1.", 50)
call inv100_RegisterItem('hslv', 'BJ58', "Healing Salve", "Regenerates lost hit points over time.", 100)
call inv100_RegisterItem('pclr', 'BJ59', "Clarity Potion", "Regenerates mana over time.", 160)
call inv100_RegisterItem('plcl', 'BJ60', "Lesser Clarity Potion", "Regenerates mana over time.", 70)
call inv100_RegisterItem('rej1', 'BJ61', "Minor Replenishment Potion", "Regenerates health and mana.", 100)
call inv100_RegisterItem('rej2', 'BJ62', "Lesser Replenishment Potion", "Regenerates health and mana.", 150)
call inv100_RegisterItem('rej3', 'BJ63', "Replenishment Potion", "Regenerates health and mana.", 150)
call inv100_RegisterItem('rej4', 'BJ64', "Greater Replenishment Potion", "Regenerates health and mana.", 450)
call inv100_RegisterItem('rej5', 'BJ65', "Lesser Scroll of Replenishment ", "Regenerates the health and mana of nearby units.", 400)
call inv100_RegisterItem('rej6', 'BJ66', "Greater Scroll of Replenishment ", "Regenerates the health and mana of nearby units.", 500)
call inv100_RegisterItem('sreg', 'BJ67', "Scroll of Regeneration", "Regenerates the health of nearby units.", 100)
call inv100_RegisterItem('gold', 'BJ68', "Gold Coins", "Gives gold to player.", 150)
call inv100_RegisterItem('lmbr', 'BJ69', "Bundle of Lumber", "Gives lumber to player.", 150)
call inv100_RegisterItem('fgun', 'BJ70', "Flare Gun", "Reveals an area on the map.", 125)
call inv100_RegisterItem('pomn', 'BJ71', "Potion of Omniscience", "Reveals the entire map.", 400)
call inv100_RegisterItem('gomn', 'BJ72', "Glyph of Omniscience", "Reveals the entire map.", 300)
call inv100_RegisterItem('wneu', 'BJ73', "Wand of Neutralization", "Dispels magical effects in a chain.", 150)
call inv100_RegisterItem('silk', 'BJ74', "Spider Silk Broach", "Webs a target air unit.", 50)
call inv100_RegisterItem('lure', 'BJ75', "Monster Lure", "Draws nearby creeps to ward.", 200)
call inv100_RegisterItem('skul', 'BJ76', "Sacrificial Skull", "Creates Blight at a target location.", 50)
call inv100_RegisterItem('moon', 'BJ77', "Moonstone", "Makes it night time.", 50)
call inv100_RegisterItem('brac', 'BJ78', "Runed Bracers", "Reduces Magic damage to Hero.", 400)
call inv100_RegisterItem('vamp', 'BJ79', "Vampiric Potion", "Damage bonus and life-stealing attack.", 75)
call inv100_RegisterItem('woms', 'BJ80', "Wand of Mana Stealing", "Steals mana.", 400)
call inv100_RegisterItem('tcas', 'BJ81', "Tiny Castle", "Creates a Castle.", 800)
call inv100_RegisterItem('tgrh', 'BJ82', "Tiny Great Hall", "Creates a Great Hall.", 600)
call inv100_RegisterItem('tsct', 'BJ83', "Ivory Tower", "Creates a Scout Tower.", 30)
call inv100_RegisterItem('wshs', 'BJ84', "Wand of Shadowsight", "Grants vision of a target unit.", 150)
call inv100_RegisterItem('tret', 'BJ85', "Tome of Retraining", "Unlearns a Hero's skills.", 300)
call inv100_RegisterItem('sneg', 'BJ86', "Staff of Negation", "Dispels magic in an area.", 200)
call inv100_RegisterItem('stel', 'BJ87', "Staff of Teleportation", "Teleports the Hero.", 100)
call inv100_RegisterItem('spre', 'BJ88', "Staff of Preservation", "Teleports a target unit home.", 150)
call inv100_RegisterItem('mcri', 'BJ89', "Mechanical Critter", "Creates a mechanical critter.", 50)
call inv100_RegisterItem('spsh', 'BJ90', "Amulet of Spell Shield", "Blocks enemy spells.", 400)
call inv100_RegisterItem('rsps', 'BJ91', "Rune of Shielding", "Gives nearby units a shield that blocks an enemy spell.", 300)
call inv100_RegisterItem('sbok', 'BJ92', "Spell Book", "A book full of random spells.", 325)
call inv100_RegisterItem('ssan', 'BJ93', "Staff of Sanctuary", "Heals and teleports a unit.", 250)
call inv100_RegisterItem('shas', 'BJ94', "Scroll of Speed", "Increases movement speed of units.", 50)
call inv100_RegisterItem('rspd', 'BJ95', "Rune of Speed", "Increases movement speed of units.", 200)
call inv100_RegisterItem('dust', 'BJ96', "Dust of Appearance", "Reveals invisible units.", 75)
call inv100_RegisterItem('oslo', 'BJ97', "Orb of Slow", "Attacks can slow enemies.", 550)
call inv100_RegisterItem('rreb', 'BJ98', "Rune of Rebirth", "Makes a monster yours.", 250)
call inv100_RegisterItem('dsum', 'BJ99', "Diamond of Summoning", "Summons your units to your Hero.", 400)
call inv100_RegisterItem('sor1', 'BK00', "Shadow Orb +1", "Gul'dan's Shadow Orb.", 50)
call inv100_RegisterItem('sor2', 'BK01', "Shadow Orb +2", "Gul'dan's Shadow Orb.", 100)
call inv100_RegisterItem('sor3', 'BK02', "Shadow Orb +3", "Gul'dan's Shadow Orb.", 200)
call inv100_RegisterItem('sor4', 'BK03', "Shadow Orb +4", "Gul'dan's Shadow Orb.", 300)
call inv100_RegisterItem('sor5', 'BK04', "Shadow Orb +5", "Gul'dan's Shadow Orb.", 350)
call inv100_RegisterItem('sor6', 'BK05', "Shadow Orb +6", "Gul'dan's Shadow Orb.", 400)
call inv100_RegisterItem('sor7', 'BK06', "Shadow Orb +7", "Gul'dan's Shadow Orb.", 550)
call inv100_RegisterItem('sor8', 'BK07', "Shadow Orb +8", "Gul'dan's Shadow Orb.", 700)
call inv100_RegisterItem('sor9', 'BK08', "Shadow Orb +9", "Gul'dan's Shadow Orb.", 900)
call inv100_RegisterItem('sora', 'BK09', "Shadow Orb +10", "Gul'dan's Shadow Orb.", 1250)
call inv100_RegisterItem('sorf', 'BK10', "Shadow Orb Fragment", "A fragment of the Shadow Orb.", 200)
call inv100_RegisterItem('fwss', 'BK11', "Frost Wyrm Skull Shield", "A powerful Undead artifact.", 750)
call inv100_RegisterItem('gmfr', 'BK12', "Gem Fragment", "A Gem Fragment from a powerful ring.", 200)
call inv100_RegisterItem('ram1', 'BK13', "Ring of the Archmagi", "A powerful artifact with a shattered gem.", 125)
call inv100_RegisterItem('ram2', 'BK14', "Ring of the Archmagi", "A powerful artifact with a fragmented gem.", 300)
call inv100_RegisterItem('ram3', 'BK15', "Ring of the Archmagi", "A powerful artifact with a nearly intact gem.", 550)
call inv100_RegisterItem('ram4', 'BK16', "Ring of the Archmagi", "A powerful artifact with a wondrous gem.", 750)
call inv100_RegisterItem('shtm', 'BK17', "Shamanic Totem", "A powerful Orcish artifact.", 600)
call inv100_RegisterItem('esaz', 'BK18', "Essence of Aszune", "A powerful Night Elf artifact.", 600)
call inv100_RegisterItem('jpnt', 'BK19', "Note to Jaina Proudmoore", "A note to Jaina Proudmoore.", 200)
call inv100_RegisterItem('shwd', 'BK20', "Shimmerweed", "A shimmering plant.", 200)
call inv100_RegisterItem('btst', 'BK21', "Battle Standard", "Thrall's Battle Standard.", 1000)
call inv100_RegisterItem('skrt', 'BK22', "Skeletal Artifact", "Soulfeast the Devourer.", 250)
call inv100_RegisterItem('thle', 'BK23', "Thunder Lizard Egg", "Massive Lizard Egg.", 200)
call inv100_RegisterItem('sclp', 'BK24', "Secret Level Powerup", "Unlocks a secret level!", 75)
call inv100_RegisterItem('gldo', 'BK25', "Orb of Kil'jaeden", "Attacks also do fire damage.", 450)
call inv100_RegisterItem('wtlg', 'BK26', "Wirt's Leg", "The One Leg.", 200)
call inv100_RegisterItem('wolg', 'BK27', "Wirt's Other Leg", "The One Other Leg.", 200)
call inv100_RegisterItem('tbsm', 'BK28', "Tiny Blacksmith", "Creates a Blacksmith.", 200)
call inv100_RegisterItem('tfar', 'BK29', "Tiny Farm", "Creates a Farm.", 75)
call inv100_RegisterItem('tlum', 'BK30', "Tiny Lumber Mill", "Creates a Lumber Mill.", 150)
call inv100_RegisterItem('tbar', 'BK31', "Tiny Barracks", "Creates a Barracks.", 160)
call inv100_RegisterItem('tbak', 'BK32', "Tiny Altar of Kings", "Creates a Altar of Kings.", 180)
call inv100_RegisterItem('mgtk', 'BK33', "Magic Key Chain", "A key chain.", 200)
call inv100_RegisterItem('stre', 'BK34', "Staff of Reanimation", "Animates a corpse.", 200)
call inv100_RegisterItem('horl', 'BK35', "Sacred Relic", "A sacred shaman artifact.", 950)
call inv100_RegisterItem('hbth', 'BK36', "Helm of Battlethirst", "|cff8b00ffUnique|r|nThis helm makes you crave combat.", 4200)
call inv100_RegisterItem('blba', 'BK37', "Bladebane Armor", "Increases armor.", 3500)
call inv100_RegisterItem('rugt', 'BK38', "Runed Gauntlets", "Increases strength and armor.", 725)
call inv100_RegisterItem('frhg', 'BK39', "Firehand Gauntlets", "Fiery gauntlets that increase armor and attack rate.", 3500)
call inv100_RegisterItem('gvsm', 'BK40', "Gloves of Spell Mastery", "|cff8b00ffUnique|r|nThese gloves have a highly magical nature.", 1400)
call inv100_RegisterItem('crdt', 'BK41', "Crown of the Deathlord", "|cffff8c00Artifact|r|nA simple crown with the emblem of an unfamiliar Paladin order on it.", 6400)
call inv100_RegisterItem('arsc', 'BK42', "Arcane Scroll", "Restores hit points, mana and increases armor to nearby units.", 1000)
call inv100_RegisterItem('scul', 'BK43', "Scroll of the Unholy Legion", "Animates nearby corpses.", 950)
call inv100_RegisterItem('tmsc', 'BK44', "Tome of Sacrifices", "|cff8b00ffUnique|r|nAn evil looking tome with runes of necromancy etched into the binding.", 1250)
call inv100_RegisterItem('dtsb', 'BK45', "Drek'thar's Spellbook", "|cffff8c00Artifact|r|nA seemingly simple spellbook, handed down from a master Farseer, Drek'thar.", 3350)
call inv100_RegisterItem('grsl', 'BK46', "Grimoire of Souls", "|cff87ceebUnique Consumable|r|nPermanently increases hit points.", 1350)
call inv100_RegisterItem('arsh', 'BK47', "Arcanite Shield", "Increases armor and reduces damage from ranged attacks.", 3500)
call inv100_RegisterItem('shdt', 'BK48', "Shield of the Deathlord", "|cffff8c00Artifact|r|nA magical shield with the emblem of an unfamiliar Paladin order on it.", 9000)
call inv100_RegisterItem('shhn', 'BK49', "Shield of Honor", "|cff8b00ffUnique|r|nA Kul Tiras navy commander's shield.", 3350)
call inv100_RegisterItem('shen', 'BK50', "Enchanted Shield", "Increases armor and hit points.", 650)
call inv100_RegisterItem('thdm', 'BK51', "Thunderlizard Diamond", "|cff8b00ffUnique|r|nA massive diamond that crackles with electricity.", 1190)
call inv100_RegisterItem('stpg', 'BK52', "Clockwork Penguin", "A small clockwork penguin that squeaks.", 450)
call inv100_RegisterItem('shrs', 'BK53', "Shimmerglaze Roast", "Restores lost hit points.", 150)
call inv100_RegisterItem('bfhr', 'BK54', "Bloodfeather's Heart", "|cff8b00ffUnique|r|nThe heart of Bloodfeather.", 2500)
call inv100_RegisterItem('cosl', 'BK55', "Celestial Orb of Souls", "|cffff8c00Artifact|r|nA bright glowing orb that instills peace.", 10000)
call inv100_RegisterItem('shcw', 'BK56', "Shaman Claws", "|cff8b00ffUnique|r|nIncreases attack damage and dispels magic.", 950)
call inv100_RegisterItem('srbd', 'BK57', "Searing Blade", "Increases attack damage.", 1650)
call inv100_RegisterItem('frgd', 'BK58', "Frostguard", "Increases attack damage.", 1400)
call inv100_RegisterItem('envl', 'BK59', "Enchanted Vial", "Regenerates health and mana.", 450)
call inv100_RegisterItem('rump', 'BK60', "Rusty Mining Pick", "Increases attack damage and gives a chance to stun.", 100)
call inv100_RegisterItem('mort', 'BK61', "Mogrin's Report", "A letter for Thrall.", 200)
call inv100_RegisterItem('srtl', 'BK62', "Serathil", "|cffff8c00Artifact|r|nThis massive axe is covered with notches and orcish runes.", 5500)
call inv100_RegisterItem('stwa', 'BK63', "Sturdy War Axe", "Increases attack damage.", 600)
call inv100_RegisterItem('klmm', 'BK64', "Killmaim", "|cffff8c00Artifact|r|nA slender crescent axe that smells of blood and salt.", 7500)
call inv100_RegisterItem('rots', 'BK65', "Scepter of the Sea", "|cff87ceebUnique Consumable|r|nSummons murlocs.", 1000)
call inv100_RegisterItem('axas', 'BK66', "Ancestral Staff", "|cffff8c00Artifact|r|nThis intricate staff has many names carved into it.", 3000)
call inv100_RegisterItem('mnsf', 'BK67', "Mindstaff", "Increases mana.", 1800)
call inv100_RegisterItem('schl', 'BK68', "Scepter of Healing", "A staff that heals others.", 4200)
call inv100_RegisterItem('asbl', 'BK69', "Assassin's Blade", "Increases attack damage.", 2000)
call inv100_RegisterItem('kgal', 'BK70', "Keg of Ale", "Increases hit point and mana regeneration.", 850)
call inv100_RegisterItem('dphe', 'BK71', "Thunder Phoenix Egg", "A rare egg of a Thunder Hawk.", 200)
call inv100_RegisterItem('dkfw', 'BK72', "Keg of Thunderwater", "A keg filled to the brim with the strongest drink available this side of Khaz Modan!", 200)
call inv100_RegisterItem('dthb', 'BK73', "Thunderbloom Bulb", "An exotic plant well known for its unstable and dangerous properties.", 200)

endfunction

VARIABLES:

fs_cache - Game Cache - 0 (default)

SCREENSHOT:

This is important, its just to show you wat it looks like when its working.
http://dimon.xgm.ru/fsgui/files/inv100_screen.jpg
inv100_screen.jpg


:cool:
 

Vulcansurge

Ultra Cool Member
Reaction score
27
90,000 chacacters... I thought it was a bit odd that you ask me to post so much... so i asked again...

I have a link to my map a few posts back incase you need to see how it works in the game... Thanks for volunteering to help.
 

Vulcansurge

Ultra Cool Member
Reaction score
27
1. There is going to be around 150 different items... So there will be around 120 custom items which i make myself, but i want to keep the old ones aswell (fuck making custom consumable items...) You'll have to explain this part of the code for me so i can add new items later on. :cool:

2. Yes, FSGUI is pretty kewl aye... Id seen it in other maps so i searched in www.wc3sear.ch... :D

3. Im not familiar with JASS, so could you tell me what CODE TAGS are? :confused:
 

Vulcansurge

Ultra Cool Member
Reaction score
27
Well actually...

I have limited the amount of items in my extended inventory to just 25 (total of 31)... could that work? ... Plus you could make the code use characters like []{};':"\|,./<>?!@#$%^&*() , which will shorten the overall load code.:D

What was up with this bit?

106? Ok I am dead. I won't be able to give you a code that handles 6,2499967241628531542505121149877e+303 possibilities if I remember.

Why does it matter how many possible combinations come up?? Doesnt the system go more along the lines of;

First it must recognise if the item(s) are there: If <item> is in region X (the trigger just moves items into regions) then set variable to value of item?

Second, add it to the code:
Your load code is:
-load <hero> <gold> <lumber>........ <itemheroslot1><itemheroslot2>.... <itemextendedslot1><itemextendedslot2>

The hero slots would go up to 6... and the extended, 25...
 

Vulcansurge

Ultra Cool Member
Reaction score
27
All I was asking about your other comment was why are you using possibilities? I understand if you decided to use them for an effect to scare me out of trying to make a code. But were you really going to make a trigger which sorted out every different possible combination? Most code dont do that.

I understand if you dont have to time, but If you do find some, help me out by either writing the code to my map or guiding me through the process... Thanks
 
D

devil

Guest
help

i have question what about how to set how many times u can load b/c on his map i played u could load like 100 times with out reloading the game in game you could load if your hero is in game.
 

Vulcansurge

Ultra Cool Member
Reaction score
27
Hard to understand what your saying here... Do you mean how many times in one game you can save your character before the whole thing stuffs up? Im pretty sure this code doesnt leak at all, so the answer would be never...
 
D

devil

Guest
i mean in game starts u load ur char then u cant load agien but in his tut u can load many times
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top