function ShowMultiBoard takes integer BoardId, integer PlayerId returns nothing
local integer loop1 = 0
if ( GetLocalPlayer() == Player( PlayerId ) ) then
loop
exitwhen ( loop1 > 3)
if ( loop1 == BoardId ) then
call MultiboardDisplay( LoadMultiboardHandle( udg_MultiboardData, loop1, PlayerId ), true )
call MultiboardMinimize( LoadMultiboardHandle( udg_MultiboardData, loop1, PlayerId ), false )
else
call MultiboardDisplay( LoadMultiboardHandle( udg_MultiboardData, loop1, PlayerId ), false )
endif
set loop1 = loop1 + 1
endloop
endif
endfunction
function PlaySoundEffect takes integer PlayerId, sound nSound returns nothing
set udg_LastPlayedSound[ PlayerId + udg_LastPlayedSoundIndex[PlayerId] ] = nSound
if ( nSound != null ) then
set udg_LastPlayedSoundIndex[PlayerId] = udg_LastPlayedSoundIndex[PlayerId] + 1
if ( GetLocalPlayer() == Player( PlayerId ) ) then
call StartSound( nSound )
endif
endif
endfunction
function ItemType2ItemName takes integer ItemType returns string
local location TempLocation = GetRectCenter(GetPlayableMapRect())
local item TempItem = CreateItemLoc( ItemType, TempLocation )
local string TempString = GetItemName( TempItem )
call RemoveItem( TempItem )
call RemoveLocation( TempLocation )
if (ItemType == 0) then
return "|cff444444Empty|r"
endif
return TempString
endfunction
Name | Type | is_array | initial_value |
ActiveBag | integer | Yes | 0 |
AllowDeselectEvent | boolean | Yes | false |
BagData | hashtable | No | |
BagIcon | string | Yes | |
BagName | string | Yes | |
BagUnlocked | string | Yes | 10000 |
EquipmentName | string | Yes | |
EquipmentSlotIcon | string | Yes | |
Hero | unit | Yes | UnitNull |
ItemManagementDummy | unit | Yes | UnitNull |
LastPlayedSound | sound | Yes | SoundNull |
LastPlayedSoundIndex | integer | Yes | 0 |
MultiboardData | hashtable | No | |
SelectionChanged | boolean | Yes | false |
function Globals takes nothing returns nothing
local integer loop1 = 0
// local location nLoc = //Location( X, Y ) //GetUnitLoc( Unit )
// Multiboard Hashtable
set udg_MultiboardData = InitHashtable()
// Bag Hashtable
set udg_BagData = InitHashtable()
// Item Management Dummies
loop
exitwhen ( loop1 > 11 )
set udg_ItemManagementDummy[ loop1 ] = CreateUnit( Player( loop1 ), 'h000', 0, 0, 270 )
set loop1 = loop1 + 1
endloop
// Heroes
set udg_Hero[0] = gg_unit_Ofar_0000
set udg_Hero[1] = gg_unit_Ofar_0034
// Bag Names OLD
set udg_BagName[0] = "Backpack"
set udg_BagName[1] = "Sack"
set udg_BagName[2] = "Pack"
set udg_BagName[3] = "Satchel"
set udg_BagName[4] = "Belt Pouch"
// Bag Names NEW
// set udg_BagName[0] = "Backpack"
// set udg_BagName[1] = "Large Bag"
// set udg_BagName[2] = "Small Backpack"
// set udg_BagName[3] = "Sack"
// set udg_BagName[4] = "Tool Box"
// set udg_BagName[5] = "Satchel"
// set udg_BagName[6] = "Belt Pouch"
// Bag Icons OLD
set udg_BagIcon[0] = "ReplaceableTextures\\CommandButtons\\BTNBackpack.blp" //Slots 6
set udg_BagIcon[1] = "ReplaceableTextures\\CommandButtons\\BTNSack.blp" //Slots 6
set udg_BagIcon[2] = "ReplaceableTextures\\CommandButtons\\BTNSmallBackpack.blp" //Slots 6
set udg_BagIcon[3] = "ReplaceableTextures\\CommandButtons\\BTNSatchel.blp" //Slots 6
set udg_BagIcon[4] = "ReplaceableTextures\\CommandButtons\\BTNBeltPouch.blp" //Slots 6
// Bag Icons NEW
// set udg_BagIcon[0] = "ReplaceableTextures\\CommandButtons\\BTNBackpack.blp" //Slots 6
// set udg_BagIcon[1] = "ReplaceableTextures\\CommandButtons\\BTNLargeBag.blp" //Slots 6
// set udg_BagIcon[2] = "ReplaceableTextures\\CommandButtons\\BTNSmallBackpack.blp"//Slots 5
// set udg_BagIcon[3] = "ReplaceableTextures\\CommandButtons\\BTNSack.blp" //Slots 4
// set udg_BagIcon[4] = "ReplaceableTextures\\CommandButtons\\BTNToolBox.blp" //Slots 4
// set udg_BagIcon[5] = "ReplaceableTextures\\CommandButtons\\BTNSatchel.blp" //Slots 2
// set udg_BagIcon[6] = "ReplaceableTextures\\CommandButtons\\BTNBeltPouch.blp" //Slots 2
// Equipment Names NEW
// set udg_BagName[0] = "Main Hand"
// set udg_BagName[1] = "Off Hand"
// set udg_BagName[2] = "Ranged"
// set udg_BagName[3] = "Ammo"
// set udg_EquipmentName[4] = "Head"
// set udg_EquipmentName[5] = "Shoulder"
// set udg_EquipmentName[6] = "Chest"
// set udg_EquipmentName[7] = "Wrists"
// set udg_EquipmentName[8] = "Hand"
// set udg_EquipmentName[9] = "Waist"
// set udg_EquipmentName[10] = "Leg"
// set udg_EquipmentName[11] = "Feet"
// set udg_EquipmentName[12] = "Neck"
// set udg_EquipmentName[13] = "Finger"
// set udg_EquipmentName[14] = "Trinket"
// set udg_EquipmentName[15] = "Belt"
// Equipment Icons NEW
// set udg_EquipmentIcon[0] = "ReplaceableTextures\\CommandButtons\\BTNBackpack.blp"
// set udg_EquipmentIcon[1] = "ReplaceableTextures\\CommandButtons\\BTNLargeBag.blp"
// set udg_EquipmentIcon[2] = "ReplaceableTextures\\CommandButtons\\BTNSmallBackpack.blp"
// set udg_EquipmentIcon[3] = "ReplaceableTextures\\CommandButtons\\BTNSack.blp"
// set udg_EquipmentIcon[4] = "ReplaceableTextures\\CommandButtons\\BTNToolBox.blp"
// set udg_EquipmentIcon[5] = "ReplaceableTextures\\CommandButtons\\BTNSatchel.blp"
// set udg_EquipmentIcon[6] = "ReplaceableTextures\\CommandButtons\\BTNBeltPouch.blp"
// set udg_EquipmentIcon[7] = "ReplaceableTextures\\CommandButtons\\BTNBackpack.blp"
// set udg_EquipmentIcon[8] = "ReplaceableTextures\\CommandButtons\\BTNLargeBag.blp"
// set udg_EquipmentIcon[9] = "ReplaceableTextures\\CommandButtons\\BTNSmallBackpack.blp"
// set udg_EquipmentIcon[10] = "ReplaceableTextures\\CommandButtons\\BTNSack.blp"
// set udg_EquipmentIcon[11] = "ReplaceableTextures\\CommandButtons\\BTNToolBox.blp"
// set udg_EquipmentIcon[12] = "ReplaceableTextures\\CommandButtons\\BTNSatchel.blp"
// set udg_EquipmentIcon[13] = "ReplaceableTextures\\CommandButtons\\BTNBeltPouch.blp"
// set udg_EquipmentIcon[14] = "ReplaceableTextures\\CommandButtons\\BTNBeltPouch.blp"
// call RemoveLocation( nLoc )
endfunction
//===========================================================================
function InitTrig_Globals takes nothing returns nothing
local trigger trg_Globals = CreateTrigger( )
call TriggerRegisterTimerEvent( trg_Globals, 0.00, false )
call TriggerAddAction( trg_Globals, function Globals )
endfunction
function DropBag takes integer PlayerId returns nothing
//Coming Soon
endfunction
function EnableBag takes integer PlayerId, integer BagId, boolean DisableBag returns nothing
local unit nUnit
if ( BagId >= 1 and BagId <= 4 ) then
call RemoveUnit( LoadUnitHandle( udg_BagData, BagId*18, PlayerId ) )
if ( not DisableBag ) then
if ( LoadUnitHandle( udg_BagData, BagId*18, PlayerId ) == null ) then
if ( BagId == 1 ) then
set nUnit = CreateUnit( Player( PlayerId ), 'h001', 0, 0, 270 )
elseif ( BagId == 2 ) then
set nUnit = CreateUnit( Player( PlayerId ), 'h002', 0, 0, 270 )
elseif ( BagId == 3 ) then
set nUnit = CreateUnit( Player( PlayerId ), 'h003', 0, 0, 270 )
elseif ( BagId == 4 ) then
set nUnit = CreateUnit( Player( PlayerId ), 'h004', 0, 0, 270 )
endif
call SaveUnitHandle( udg_BagData, BagId*18, PlayerId, nUnit )
endif
else
call SaveUnitHandle( udg_BagData, BagId*18, PlayerId, null )
endif
endif
set nUnit = null
call RemoveUnit( nUnit )
endfunction
function UpdateBagBoard takes integer PlayerId returns nothing
local multiboard nBoard = LoadMultiboardHandle( udg_MultiboardData, 1, PlayerId )
local multiboarditem nBoardItem
local string Value
local string Value2
local integer Row
local integer Column = 1
local integer Bag = 0
loop
exitwhen ( Bag > 4 )
set Row = 2
loop
exitwhen ( Row > 7 ) //Bag*18+InvSlot*3+ValueType+(Bag+1)
set Value = I2S( LoadInteger( udg_BagData, Bag*18+(Row-2)*3+1+(Bag+1), PlayerId ) )
set Value2 = " x "
if ( S2I( Value ) == 0 ) then
set Value = " |cff444444" + Value + "|r"
set Value2 = "|cff444444" + Value2 + "|r"
else//if ( StringLength(Value) == 1 ) then
set Value = " |cffCCCCCC" + Value + "|r"
set Value2 = "|cffCCCCCC" + Value2 + "|r"
endif
set nBoardItem = MultiboardGetItem( nBoard, Row-1, Column-1 )
call MultiboardSetItemValue( nBoardItem, Value )
call MultiboardReleaseItem( nBoardItem )
set nBoardItem = MultiboardGetItem( nBoard, Row-1, Column )
call MultiboardSetItemValue( nBoardItem, Value2 )
call MultiboardReleaseItem( nBoardItem )
set Row = Row + 1
endloop
set Column = Column + 2
set nBoardItem = MultiboardGetItem( nBoard, 0, Column-1 )
if ( udg_ActiveBag[PlayerId] == Bag ) then
call MultiboardSetItemValue( nBoardItem, " |cffFFCC00" + udg_BagName[Bag] + "|r" )
elseif ( LoadUnitHandle( udg_BagData, Bag*18, PlayerId ) == null and Bag != 0) then
call MultiboardSetItemValue( nBoardItem, " |cff444444" + udg_BagName[Bag] + "|r" )
else
call MultiboardSetItemValue( nBoardItem, " |cffCCCCCC" + udg_BagName[Bag] + "|r" )
endif
call MultiboardReleaseItem( nBoardItem )
set Row = 2
loop
exitwhen ( Row > 7 ) //Bag*18+InvSlot*3+ValueType
set Value = ItemType2ItemName( LoadInteger( udg_BagData, Bag*18+(Row-2)*3+0+Bag+1, PlayerId ) )
set nBoardItem = MultiboardGetItem( nBoard, Row-1, Column-1 )
call MultiboardSetItemValue( nBoardItem, Value )
call MultiboardReleaseItem( nBoardItem )
set Row = Row + 1
endloop
set Column = Column + 1
set Bag = Bag + 1
endloop
set nBoard = null
call DestroyMultiboard( nBoard )
endfunction
function RemoveSlotSkips takes unit nUnit returns nothing
local integer loop1 = 0
local item nItem
loop
exitwhen (loop1 > 5)
set nItem = UnitItemInSlot( nUnit, loop1 )
if ( GetItemTypeId( nItem ) == 'I000' ) then
call RemoveItem( nItem )
endif
set loop1 = loop1 + 1
endloop
endfunction
function ItemRemoveAll takes unit nUnit returns boolean
local integer loop1 = 0
local item nItem
local boolean empty = true
loop
exitwhen (loop1 > 5)
set nItem = UnitItemInSlot( nUnit, loop1 )
if ( nItem != null ) then
set empty = false
call RemoveItem( nItem )
endif
set loop1 = loop1 + 1
endloop
return empty
endfunction
function ItemDropAll takes unit nUnit returns boolean
local integer loop1 = 0
local item nItem
local boolean empty = true
loop
exitwhen (loop1 > 5)
set nItem = UnitItemInSlot( nUnit, loop1 )
if ( nItem != null ) then
set empty = false
call UnitRemoveItem( nUnit, nItem )
set nItem = null
endif
call RemoveItem( nItem )
set loop1 = loop1 + 1
endloop
return empty
endfunction
function SaveBag takes integer PlayerId, integer BagId returns nothing
local integer loop1 = 0
local item nItem
loop
exitwhen ( loop1 > 5 )
set nItem = UnitItemInSlot( udg_Hero[PlayerId], loop1 )
call SaveInteger( udg_BagData, BagId*18+loop1*3+0+BagId+1, PlayerId, GetItemTypeId( nItem ) )
call SaveInteger( udg_BagData, BagId*18+loop1*3+1+BagId+1, PlayerId, GetItemCharges( nItem ) )
call SaveInteger( udg_BagData, BagId*18+loop1*3+2+BagId+1, PlayerId, GetItemUserData( nItem ) )
set nItem = null
call RemoveItem( nItem )
set loop1 = loop1 + 1
endloop
endfunction
function LoadBag takes unit nUnit, integer BagId returns nothing
local integer PlayerId = GetPlayerId( GetOwningPlayer( nUnit ) )
local integer loop1 = 0
local integer nItemType
local item nItem
call ItemRemoveAll( nUnit )
loop
exitwhen (loop1 > 5)
set nItemType = LoadInteger( udg_BagData, BagId*18+loop1*3+0+BagId+1, PlayerId )
if ( nItemType == 0 ) then
set nItem = CreateItem( 'I000', 0, 0 )
else
set nItem = CreateItem( nItemType, 0, 0 )
endif
call SetItemCharges( nItem, LoadInteger( udg_BagData, BagId*18+loop1*3+1+BagId+1, PlayerId ) )
call SetItemUserData( nItem, LoadInteger( udg_BagData, BagId*18+loop1*3+2+BagId+1, PlayerId ) )
call UnitAddItem( nUnit, nItem )
set nItem = null
call RemoveItem( nItem )
set loop1 = loop1 + 1
endloop
call RemoveSlotSkips( nUnit )
endfunction
function ConvertBagId takes integer BagId returns integer
if ( BagId == 'A000' ) then //Backpack
return 0
elseif ( BagId == 'A002' ) then //Sack
return 1
elseif ( BagId == 'A003' ) then //Pack
return 2
elseif ( BagId == 'A005' ) then //Satchel
return 3
elseif ( BagId == 'A004' ) then //Belt Pouch
return 4
endif
return -1
endfunction
function OpenItemManagement takes integer PlayerId returns nothing
set udg_SelectionChanged[PlayerId] = true
//call UnitRemoveAbility( udg_ItemManagementDummy[PlayerId], 'Aloc' )
call SaveBag( PlayerId, udg_ActiveBag[PlayerId] )
call LoadBag( udg_ItemManagementDummy[PlayerId], udg_ActiveBag[PlayerId] )
call UpdateBagBoard( PlayerId )
if (GetLocalPlayer() == Player(PlayerId) ) then
call ClearSelection()
call SelectUnit( udg_ItemManagementDummy[PlayerId], true )
endif
call PauseUnit( udg_Hero[PlayerId], true )
call SetUnitPosition( udg_ItemManagementDummy[PlayerId], GetUnitX( udg_Hero[PlayerId] ), GetUnitY( udg_Hero[PlayerId] ) )
endfunction
function CloseItemManagement takes integer PlayerId, boolean CloseUsingCancelButton returns nothing
set udg_SelectionChanged[PlayerId] = false
call PauseUnit( udg_Hero[PlayerId], false )
call IssueImmediateOrder( udg_Hero[PlayerId], "stop" )
if ( CloseUsingCancelButton ) then
if (GetLocalPlayer() == Player(PlayerId) ) then
call ClearSelection()
call SelectUnit( udg_Hero[PlayerId], true )
endif
else
if (GetLocalPlayer() == Player( PlayerId ) ) then
call SelectUnit( udg_ItemManagementDummy[PlayerId], false )
endif
endif
//call UnitAddAbility( udg_ItemManagementDummy[PlayerId], 'Aloc' )
endfunction
//===========================================================================
function InitTrig_InventoryFunctions takes nothing returns nothing
endfunction
function MenuEvents takes nothing returns nothing
local integer CastId = GetSpellAbilityId()
local integer PlayerId = GetPlayerId( GetOwningPlayer( GetTriggerUnit() ) )
local player nPlayer = Player( PlayerId )
if ( CastId == 'A006' ) then //Open Item Management
call OpenItemManagement( PlayerId )
call ShowMultiBoard( 1, PlayerId )
elseif ( CastId == 'A007' ) then //Cancel
call CloseItemManagement( PlayerId, true )
call ShowMultiBoard( 0, PlayerId )
elseif ( CastId == 'A00A' ) then //Drop All Items
if ( ItemDropAll( udg_Hero[ PlayerId ] ) ) then
call DisplayTimedTextToPlayer( nPlayer, 0, 0, 1.00, "|cffFFCC00" + "Selected bag is already empty." + "|r" )
call PlaySoundEffect( PlayerId, gg_snd_Error )
else
call DisplayTimedTextToPlayer( nPlayer, 0, 0, 1.00, "Dropped all items from " + "|cffFFCC00" + udg_BagName[ udg_ActiveBag[PlayerId] ] + "|r" )
call PlaySoundEffect( PlayerId, gg_snd_ChangeBag )
call SaveBag( PlayerId, udg_ActiveBag[PlayerId] )
call LoadBag( udg_ItemManagementDummy[PlayerId], udg_ActiveBag[PlayerId] )
call UpdateBagBoard( PlayerId )
endif
else
set CastId = ConvertBagId( CastId )
if ( CastId == -1 ) then
return
elseif ( udg_ActiveBag[ PlayerId ] != CastId ) then
set udg_ActiveBag[ PlayerId ] = CastId
call DisplayTimedTextToPlayer( nPlayer, 0, 0, 1.00, "Opened " + "|cffFFCC00" + udg_BagName[ CastId ] + "|r" )
call PlaySoundEffect( PlayerId, gg_snd_ChangeBag )
call LoadBag( udg_Hero[ PlayerId ], CastId )
call SaveBag( PlayerId, udg_ActiveBag[ PlayerId ] )
call LoadBag( udg_ItemManagementDummy[ PlayerId ], udg_ActiveBag[ PlayerId ] )
call UpdateBagBoard( PlayerId )
else
call DisplayTimedTextToPlayer( nPlayer, 0, 0, 1.00, "|cffFFCC00" + "Selected bag is already open." + "|r" )
call PlaySoundEffect( PlayerId, gg_snd_Error )
endif
endif
set nPlayer = null
call RemovePlayer( nPlayer, PLAYER_GAME_RESULT_NEUTRAL )
endfunction
//===========================================================================
function InitTrig_MenuEvents takes nothing returns nothing
local trigger trg_MenuEvents = CreateTrigger( )
local integer loop1 = 0
loop
exitwhen ( loop1 > 11 )
call TriggerRegisterPlayerUnitEvent( trg_MenuEvents, Player(loop1), EVENT_PLAYER_UNIT_SPELL_CAST, null )
set loop1 = loop1 + 1
endloop
call TriggerAddAction( trg_MenuEvents, function MenuEvents )
endfunction
function LimitSelection takes nothing returns nothing
local integer PlayerId = GetPlayerId( GetTriggerPlayer() )
if ( udg_SelectionChanged[ PlayerId ] == true ) then
if ( GetTriggerUnit() != udg_ItemManagementDummy[ PlayerId ] ) then
call CloseItemManagement( PlayerId, false )
call ShowMultiBoard( 0, PlayerId )
endif
endif
endfunction
//===========================================================================
function InitTrig_LimitSelection takes nothing returns nothing
local trigger trg_LimitSelection = CreateTrigger( )
local integer loop1 = 0
loop
exitwhen ( loop1 > 11 )
call TriggerRegisterPlayerUnitEvent( trg_LimitSelection, Player(loop1), EVENT_PLAYER_UNIT_SELECTED, null )
set loop1 = loop1 + 1
endloop
call TriggerAddAction( trg_LimitSelection, function LimitSelection )
endfunction
function DeselectOnAttack takes nothing returns nothing
local integer PlayerId = GetPlayerId( GetOwningPlayer( GetTriggerUnit() ) )
if ( IsUnitType( GetTriggerUnit(), UNIT_TYPE_HERO ) == true ) then
if ( udg_SelectionChanged[ PlayerId ] == true ) then
call CloseItemManagement( PlayerId, true )
call ShowMultiBoard( 0, PlayerId )
endif
endif
endfunction
//===========================================================================
function InitTrig_DeselectOnAttack takes nothing returns nothing
local trigger trg_DeselectOnAttack = CreateTrigger( )
local integer loop1 = 0
loop
exitwhen ( loop1 > 11 )
call TriggerRegisterPlayerUnitEvent( trg_DeselectOnAttack, Player(loop1), EVENT_PLAYER_UNIT_ATTACKED, null )
set loop1 = loop1 + 1
endloop
call TriggerAddAction( trg_DeselectOnAttack, function DeselectOnAttack )
endfunction
function InitBagBoard takes nothing returns nothing
local integer Loop1 = 0
local integer Loop2
local multiboard nBoard
loop
exitwhen ( Loop1 > 11 )
set nBoard = CreateMultiboard()
call MultiboardSetColumnCount( nBoard, 15)
call MultiboardSetRowCount( nBoard, 7)
call MultiboardSetTitleText( nBoard, "Inventory")
call MultiboardSetItemStyleBJ( nBoard, 0, 0, true, false )
set Loop2 = 1
loop
exitwhen Loop2 > 15
if ( ModuloInteger( Loop2, 3) == 0 ) then
call MultiboardSetItemWidthBJ( nBoard, Loop2, 0, 10.00 )
call MultiboardSetItemValueBJ( nBoard, Loop2, 0, "|cff444444" + "Empty" + "|r" )
call MultiboardSetItemWidthBJ( nBoard, Loop2, 1, 12.00 )
call MultiboardSetItemStyleBJ( nBoard, Loop2, 1, true, true )
call MultiboardSetItemIconBJ( nBoard, Loop2, 1, udg_BagIcon[Loop2/3-1] )
call MultiboardSetItemValueBJ( nBoard, Loop2, 1, ( udg_BagName[Loop2/3-1] ) )
elseif ( ModuloInteger( Loop2 + 1, 3) == 0 ) then
call MultiboardSetItemWidthBJ( nBoard, Loop2, 0, 1.50 )
call MultiboardSetItemValueBJ( nBoard, Loop2, 0, "|cff444444" + " x " + "|r" )
call MultiboardSetItemWidthBJ( nBoard, Loop2, 1, 0.50 )
call MultiboardSetItemValueBJ( nBoard, Loop2, 1, "" )
else
call MultiboardSetItemWidthBJ( nBoard, Loop2, 0, 1.50 )
call MultiboardSetItemValueBJ( nBoard, Loop2, 0, "|cff444444" + "00" + "|r" )
call MultiboardSetItemWidthBJ( nBoard, Loop2, 1, 0.50 )
call MultiboardSetItemValueBJ( nBoard, Loop2, 1, "" )
endif
set Loop2 = Loop2 + 1
endloop
call SaveMultiboardHandle( udg_MultiboardData, 1, Loop1, nBoard )
call SetPlayerTechResearched( Player(Loop1), 'R004', 1 )
call TriggerSleepAction(0.00)
set Loop1 = Loop1 + 1
endloop
endfunction
//===========================================================================
function InitTrig_InitBagBoard takes nothing returns nothing
local trigger trg_InitBagBoard = CreateTrigger( )
call TriggerRegisterTimerEvent( trg_InitBagBoard, 0.00, false )
call TriggerAddAction( trg_InitBagBoard, function InitBagBoard )
endfunction
function TEST_EnableBag takes nothing returns nothing
local string nString = GetEventPlayerChatString()
local integer BagId
local integer PlayerId = GetPlayerId( GetTriggerPlayer() )
if ( SubString( nString, 0, 7 ) == "Disable" ) then
if ( StringLength( GetEventPlayerChatString() ) < 14 ) then
set BagId = S2I( SubString( nString, 10, 11 ) )
if ( SubString( nString, 10, 13 ) == "All" ) then
call EnableBag( PlayerId, 1, true )
call EnableBag( PlayerId, 2, true )
call EnableBag( PlayerId, 3, true )
call EnableBag( PlayerId, 4, true )
call DisplayTimedTextToPlayer( Player( PlayerId ), 0, 0, 1.00, "|cffFFCC00" + "All bags" + "|r" + " disabled" )
else
call EnableBag( PlayerId, BagId, true )
call DisplayTimedTextToPlayer( Player( PlayerId ), 0, 0, 1.00, "|cffFFCC00" + udg_BagName[BagId] + "|r" + " disabled" )
endif
endif
else
if ( StringLength( GetEventPlayerChatString() ) < 13 ) then
set BagId = S2I( SubString( nString, 9, 10 ) )
if ( SubString( nString, 9, 12 ) == "All" ) then
call EnableBag( PlayerId, 1, false )
call EnableBag( PlayerId, 2, false )
call EnableBag( PlayerId, 3, false )
call EnableBag( PlayerId, 4, false )
call DisplayTimedTextToPlayer( Player( PlayerId ), 0, 0, 1.00, "|cffFFCC00" + "All bags" + "|r" + " enabled" )
else
call EnableBag( PlayerId, BagId, false )
call DisplayTimedTextToPlayer( Player( PlayerId ), 0, 0, 1.00, "|cffFFCC00" + udg_BagName[BagId] + "|r" + " enabled" )
endif
endif
endif
call TriggerSleepAction(0.00)
call UpdateBagBoard( PlayerId )
endfunction
//===========================================================================
function InitTrig_TEST_EnableBag takes nothing returns nothing
local trigger trg_TEST_EnableBag = CreateTrigger( )
local integer loop1 = 0
loop
exitwhen ( loop1 > 11 )
call TriggerRegisterPlayerChatEvent( trg_TEST_EnableBag, Player(loop1), "EnableBag", false )
call TriggerRegisterPlayerChatEvent( trg_TEST_EnableBag, Player(loop1), "DisableBag", false )
set loop1 = loop1 + 1
endloop
call TriggerAddAction( trg_TEST_EnableBag, function TEST_EnableBag )
endfunction
function TEST_Help takes nothing returns nothing
local string array nMessage
local integer loop1 = 0
local integer PlayerId = GetPlayerId( GetTriggerPlayer() )
set nMessage[0] = "|cff5555CC" +"Help:" + "|r"
set nMessage[1] = "|cff5555CC" + " You can enable and disable bag by typing 'EnableBagX' or 'DisableBagX'" + "|r"
set nMessage[2] = "|cff5555CC" + " X means the BagId, which range from 1 to 4. 'All' applies to all bags." + "|r"
loop
exitwhen ( nMessage[loop1] == null)
call DisplayTimedTextToPlayer( Player(PlayerId), 0, 0, 10.0, nMessage[loop1] )
set loop1 = loop1 + 1
endloop
endfunction
//===========================================================================
function InitTrig_TEST_Help takes nothing returns nothing
local trigger trg_TEST_Help = CreateTrigger( )
local integer loop1 = 0
loop
exitwhen ( loop1 > 11 )
call TriggerRegisterPlayerChatEvent( trg_TEST_Help, Player(loop1), "Help", true )
set loop1 = loop1 + 1
endloop
call TriggerAddAction( trg_TEST_Help, function TEST_Help )
endfunction
function Credits takes nothing returns nothing
local integer loop1 = 0
local real duration = 45.00
local string array message
set message[0] = "Wezthal - Creator of this system"
set message[1] = "NFWar - BagOut and DropBag icons"
set message[2] = "|||GORO||| - Bag item model"
set message[3] = "Blizzard Entertaiment - Bag icons"
call DisplayTimedTextToForce( GetPlayersAll(), duration, "|cffFFCC00" + " --- --- Credits --- --- " + "|r" )
loop
exitwhen ( message[loop1] == null )
call DisplayTimedTextToForce( GetPlayersAll(), duration, "|cffFFCC00" + message[loop1] + "|r" )
set loop1 = loop1 + 1
endloop
call DisplayTimedTextToForce( GetPlayersAll(), duration, "|cffFFCC00" + " --- --- --- --- --- ---" + "|r" )
call DisplayTimedTextToForce( GetPlayersAll(), duration, " " )
endfunction
//===========================================================================
function InitTrig_Credits takes nothing returns nothing
local trigger trg_Credits = CreateTrigger( )
call TriggerRegisterTimerEventSingle( trg_Credits, 0.00 )
call TriggerAddAction( trg_Credits, function Credits )
endfunction