- Joined
- Aug 14, 2006
- Messages
- 7,602
Hey.
I have a little problem which I can't fix myself because I'm not a JASSER. So, the problem is that when I go with full inventory to this Auction Hall, the Master won't give me an item.
So could someone fix this little problem?
Probably best to test it by yourself so that you understand the problem properly. I believe this is easy to fix.
("-X" to bid and "ESC" to view options)
Rep for the helper. Map is attached to the post.
I have a little problem which I can't fix myself because I'm not a JASSER. So, the problem is that when I go with full inventory to this Auction Hall, the Master won't give me an item.
So could someone fix this little problem?
Probably best to test it by yourself so that you understand the problem properly. I believe this is easy to fix.
("-X" to bid and "ESC" to view options)
JASS:
//TESH.scrollpos=479
//TESH.alwaysfold=0
// Values //
// Starting price //
// Bid increase //
// Set rounds //
//=====================//
// Initializes the system's variables and settings
function AH_Setup takes nothing returns nothing
local integer i = 0
local integer j = 1
local itempool AH_Itempool = CreateItemPool()
// The region of entering AH
set udg_AH_Enter_Rect = gg_rct_AHEnter
// The AH camera
set udg_AH_Enter_Cam = gg_cam_AHCamera
// Camera bounds region for AH
set udg_AH_Cam_Bounds = gg_rct_AHCamBounds
// Hero's position at AH
set udg_AH_Hero_Point = Location(GetRectCenterX(gg_rct_AHHeroPoint), GetRectCenterY(gg_rct_AHHeroPoint))
// The auctioneer
set udg_AH_Auctionists[0] = gg_unit_Hblm_0001
// The auctionists
set udg_AH_Auctionists[1] = gg_unit_Hmkg_0002 // Djoses
set udg_AH_Auctionists[2] = gg_unit_Hamg_0003 // Otzmos
set udg_AH_Auctionists[3] = gg_unit_Obla_0004 // Sannique
set udg_AH_Auctionists[4] = gg_unit_Ofar_0005 // Tiasarah
//* ~~~~~~~~~~~~~~~~~~~~ Setup auctionist preferrals ~~~~~~~~~~~~~~~~~~~ */
//* ~~~~~~~~~ 0 = Weapon || 1 = Armor || 2 = Jewel || 3 = Other ~~~~~~~~ */
set i = GetHandleId(udg_AH_Auctionists[1])
call SaveInteger(udg_AH_Hash, i, StringHash("prefers"), 0)
call SaveInteger(udg_AH_Hash, i, StringHash("dislikes"), 2)
call SaveStr(udg_AH_Hash, i, StringHash("name"), "Djoses")
set i = GetHandleId(udg_AH_Auctionists[2])
call SaveInteger(udg_AH_Hash, i, StringHash("prefers"), 1)
call SaveInteger(udg_AH_Hash, i, StringHash("dislikes"), 3)
call SaveStr(udg_AH_Hash, i, StringHash("name"), "Otzmos")
set i = GetHandleId(udg_AH_Auctionists[3])
call SaveInteger(udg_AH_Hash, i, StringHash("prefers"), 2)
call SaveInteger(udg_AH_Hash, i, StringHash("dislikes"), 1)
call SaveStr(udg_AH_Hash, i, StringHash("name"), "Sannique")
set i = GetHandleId(udg_AH_Auctionists[4])
call SaveInteger(udg_AH_Hash, i, StringHash("prefers"), 3)
call SaveInteger(udg_AH_Hash, i, StringHash("dislikes"), 0)
call SaveStr(udg_AH_Hash, i, StringHash("name"), "Tiasarah")
//* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
//* ~~~~~~~~~~~~~~~~~~~~~~~~ Setup items to be sold ~~~~~~~~~~~~~~~~~~~~ */
set i = 1
set udg_AH_Item_Types[i] = 'ratc'
call SaveBoolean(udg_AH_Hash, udg_AH_Item_Types[i], 0, FALSE) // Is sold more than once?
call SaveInteger(udg_AH_Hash, udg_AH_Item_Types[i], 4, 0) // Item class
call SaveInteger(udg_AH_Hash, udg_AH_Item_Types[i], 1, 500) // Default price
set i = i + 1
set udg_AH_Item_Types[i] = 'rat6'
call SaveBoolean(udg_AH_Hash, udg_AH_Item_Types[i], 0, TRUE)
call SaveInteger(udg_AH_Hash, udg_AH_Item_Types[i], 4, 0)
call SaveInteger(udg_AH_Hash, udg_AH_Item_Types[i], 1, 300)
set i = i + 1
set udg_AH_Item_Types[i] = 'rde1'
call SaveBoolean(udg_AH_Hash, udg_AH_Item_Types[i], 0, TRUE)
call SaveInteger(udg_AH_Hash, udg_AH_Item_Types[i], 4, 2)
call SaveInteger(udg_AH_Hash, udg_AH_Item_Types[i], 1, 100)
set i = i + 1
set udg_AH_Item_Types[i] = 'rde3'
call SaveBoolean(udg_AH_Hash, udg_AH_Item_Types[i], 0, TRUE)
call SaveInteger(udg_AH_Hash, udg_AH_Item_Types[i], 4, 2)
call SaveInteger(udg_AH_Hash, udg_AH_Item_Types[i], 1, 400)
set i = i + 1
set udg_AH_Item_Types[i] = 'gcel'
call SaveBoolean(udg_AH_Hash, udg_AH_Item_Types[i], 0, TRUE)
call SaveInteger(udg_AH_Hash, udg_AH_Item_Types[i], 4, 0)
call SaveInteger(udg_AH_Hash, udg_AH_Item_Types[i], 1, 350)
set i = i + 1
set udg_AH_Item_Types[i] = 'rag1'
call SaveBoolean(udg_AH_Hash, udg_AH_Item_Types[i], 0, TRUE)
call SaveInteger(udg_AH_Hash, udg_AH_Item_Types[i], 4, 0)
call SaveInteger(udg_AH_Hash, udg_AH_Item_Types[i], 1, 400)
//* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
//* ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Don't change ~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
set udg_AH_Rounds_Initial = i
set udg_AH_Rounds = i
loop
call ItemPoolAddItemType(AH_Itempool, udg_AH_Item_Types[j], 1)
exitwhen j == i
set j = j + 1
endloop
call SaveItemPoolHandle(udg_AH_Hash, 0, StringHash("itempool"), AH_Itempool)
//* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
endfunction
function AH_Refresh_Itempool takes nothing returns nothing
local integer i = udg_AH_Rounds_Initial
local itempool ip = LoadItemPoolHandle(udg_AH_Hash, 0, StringHash("itempool"))
local integer it
loop
set it = LoadInteger(udg_AH_Hash, StringHash("items"), i)
if it != null then
if LoadBoolean(udg_AH_Hash, it, 0) == TRUE then
call ItemPoolAddItemType(ip, it, 1)
set udg_AH_Rounds = udg_AH_Rounds + 1
endif
call RemoveSavedHandle(udg_AH_Hash, StringHash("items"), i)
endif
exitwhen i == 0
set i = i - 1
endloop
set ip = null
endfunction
// Begins/ends a cinematic
function AH_Cin takes boolean stop, real fadeTime returns nothing
call ClearTextMessages()
call ShowInterface(stop, fadeTime)
call EnableOcclusion(stop)
endfunction
function AH_About takes nothing returns nothing
call AH_Cin(false, 0.3)
call TransmissionFromUnitWithNameBJ( bj_FORCE_PLAYER[0], null, null, null, "This is a very informative message containing important information about the Auction Hall.", bj_TIMETYPE_ADD, 0, true )
call TriggerSleepAction(0)
call AH_Cin(true, 0.3)
if TimerGetRemaining(udg_AH_Timer_Shout) > 0 then
call ResumeTimer(udg_AH_Timer_Shout)
endif
if TimerGetRemaining(udg_AH_Timer_Bidders) > 0 then
call ResumeTimer(udg_AH_Timer_Bidders)
endif
endfunction
function AH_Exit takes nothing returns nothing
call ResetUnitLookAt(udg_AH_Auctionists[0])
call RemoveItem(UnitItemInSlot(udg_AH_Auctionists[0], 0))
call AH_Refresh_Itempool()
// call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 0.30, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
// call AH_Cin(true, 0.3)
call ResetToGameCamera(2)
call SetCameraBoundsToRect(bj_mapInitialCameraBounds)
call PauseTimer(udg_AH_Timer_Shout)
call PauseTimer(udg_AH_Timer_Bidders)
call DisableTrigger(udg_AH_Trig_Next)
call DisableTrigger(udg_AH_Trig_Menu)
call DisableTrigger(udg_AH_Pause_Hero)
call DisableTrigger(udg_AH_Trig_Selection)
//call MultiboardDisplay(udg_AH_MB, false)
//call MultiboardDisplay(xxx, true)
call EnableSelect( true, true )
call EnableDragSelect( true, true )
call SelectUnit(udg_AH_Auctionists[0], false)
call SelectUnit(udg_AH_Hero, true)
call EnableTrigger(udg_AH_Trig_Enter)
endfunction
function AH_Auctioneer takes nothing returns nothing
local integer count = LoadInteger(udg_AH_Hash, 0, StringHash("shoutCount"))
local integer rounds = LoadInteger(udg_AH_Hash, 0, StringHash("rounds"))
set bj_lastCreatedTextTag = CreateTextTag()
call SetTextTagPosUnit(bj_lastCreatedTextTag, udg_AH_Auctionists[0], 0)
call SetTextTagPermanent(bj_lastCreatedTextTag, FALSE)
if count == 1 then
call SetTextTagFadepoint(bj_lastCreatedTextTag, 0.7)
call SetTextTagLifespan(bj_lastCreatedTextTag, 0.9)
call SetTextTagText(bj_lastCreatedTextTag, "Going once!", 0.022)
call SaveInteger(udg_AH_Hash, 0, StringHash("shoutCount"), count + 1)
// Speed
call TimerStart(udg_AH_Timer_Shout, GetRandomReal(4,5), false, function AH_Auctioneer)
elseif count == 2 then
call SetTextTagFadepoint(bj_lastCreatedTextTag, 0.7)
call SetTextTagLifespan(bj_lastCreatedTextTag, 0.9)
call SetTextTagText(bj_lastCreatedTextTag, "Going twice!", 0.022)
call SaveInteger(udg_AH_Hash, 0, StringHash("shoutCount"), count + 1)
// Speed
call TimerStart(udg_AH_Timer_Shout, GetRandomReal(4,5), false, function AH_Auctioneer)
else
call DisableTrigger(udg_AH_Trig_Next)
call DisableTrigger(udg_AH_Trig_PlayerBid)
call PauseTimer(udg_AH_Timer_Bidders)
if LoadUnitHandle(udg_AH_Hash, 0, StringHash("lastBidder")) == udg_AH_Hero then
call UnitAddItem(udg_AH_Hero, LoadItemHandle(udg_AH_Hash, StringHash("lastItem"), 0))
call SetPlayerState(Player(0), PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(Player(0), PLAYER_STATE_RESOURCE_GOLD) - udg_AH_Current_Price)
else
call RemoveItem(LoadItemHandle(udg_AH_Hash, StringHash("lastItem"), 0))
endif
if rounds != 0 then
call TimerStart(udg_AH_Timer_NewItem, 1, false, null)
call SetTextTagFadepoint(bj_lastCreatedTextTag, 0.7)
call SetTextTagLifespan(bj_lastCreatedTextTag, 0.9)
call SetTextTagText(bj_lastCreatedTextTag, "Sold!", 0.022)
call ResetUnitLookAt(udg_AH_Auctionists[0])
else
call UnitRemoveItemFromSlot(udg_AH_Auctionists[0], 0)
call UnitRemoveItemFromSlot(udg_AH_Auctionists[0], 1)
call UnitRemoveItemFromSlot(udg_AH_Auctionists[0], 2)
call UnitRemoveItemFromSlot(udg_AH_Auctionists[0], 3)
call UnitRemoveItemFromSlot(udg_AH_Auctionists[0], 4)
call UnitRemoveItemFromSlot(udg_AH_Auctionists[0], 5)
call SetTextTagFadepoint(bj_lastCreatedTextTag, 1.7)
call SetTextTagLifespan(bj_lastCreatedTextTag, 2.0)
call SetTextTagText(bj_lastCreatedTextTag, "Sold! And we will take a small break.", 0.022)
call ResetUnitLookAt(udg_AH_Auctionists[0])
call AH_Exit()
endif
endif
endfunction
function AH_Hear_Bid takes nothing returns nothing
set bj_lastCreatedTextTag = CreateTextTag()
call SetTextTagPosUnit(bj_lastCreatedTextTag, udg_AH_Auctionists[0], 0)
call SetTextTagFadepoint(bj_lastCreatedTextTag, 0.7)
call SetTextTagLifespan(bj_lastCreatedTextTag, 0.9)
call SetTextTagPermanent(bj_lastCreatedTextTag, FALSE)
call SetTextTagText(bj_lastCreatedTextTag, "I heard " + I2S(udg_AH_Current_Price) + "!", 0.022)
call SetUnitLookAt( udg_AH_Auctionists[0], "bone_chest", LoadUnitHandle(udg_AH_Hash, 0, StringHash("lastBidder")), 0, 0, 60 )
call SetUnitLookAt( udg_AH_Auctionists[0], "bone_head", LoadUnitHandle(udg_AH_Hash, 0, StringHash("lastBidder")), 0, 0, 90 )
call SaveInteger(udg_AH_Hash, 0, StringHash("shoutCount"), 1)
// Speed
call TimerStart(udg_AH_Timer_Shout, GetRandomReal(4,5), false, function AH_Auctioneer)
endfunction
// Auctionist AI
function AH_Timer_Expire takes nothing returns nothing
local integer itemtypeid = GetItemTypeId(LoadItemHandle(udg_AH_Hash, StringHash("lastItem"), 0))
local integer defaultPrice = LoadInteger(udg_AH_Hash, itemtypeid, 1)
local real maxPrice = defaultPrice * 1.25
local real bidChance
local boolean prefers = FALSE
local unit u = udg_AH_Auctionists[GetRandomInt(1,4)]
local integer unitid = GetHandleId(u)
// Is the chosen unit not the same as previous chosen unit
if u != LoadUnitHandle(udg_AH_Hash, 0, StringHash("lastChosen")) then
call SaveUnitHandle(udg_AH_Hash, 0, StringHash("lastChosen"), u)
if u != LoadUnitHandle(udg_AH_Hash, 0, StringHash("lastBidder")) then
if udg_AH_Current_Price < maxPrice then
// Check whether the bidder dislikes the item category
if udg_AH_Current_Price < defaultPrice * 0.75 then
set bidChance = 1
else
set bidChance = 1+2*(1-(0.25+I2R(udg_AH_Current_Price)/I2R(defaultPrice)))
// Check whether the bidder prefers the item category
if LoadInteger(udg_AH_Hash, itemtypeid, 4) == LoadInteger(udg_AH_Hash, unitid, StringHash("prefers")) then
set bidChance = bidChance + 0.2
set prefers = TRUE
elseif LoadInteger(udg_AH_Hash, itemtypeid, 4) == LoadInteger(udg_AH_Hash, unitid, StringHash("dislikes")) then
set bidChance = bidChance - 0.2
endif
endif
//call BJDebugMsg(R2S(bidChance))
// Does the bidder make a bid
if GetRandomReal(0,1) < bidChance then
// Bid increase
set udg_AH_Current_Price = R2I(udg_AH_Current_Price + defaultPrice * GetRandomReal(0.03, 0.08))
call MultiboardSetItemValue(MultiboardGetItem(udg_AH_MB, 1, 0), LoadStr(udg_AH_Hash, unitid, StringHash("name")) + ": " + I2S(udg_AH_Current_Price) + " Gold")
set bj_lastCreatedTextTag = CreateTextTag()
call SetTextTagPosUnit(bj_lastCreatedTextTag, u, 0)
call SetTextTagFadepoint(bj_lastCreatedTextTag, 0.7)
call SetTextTagLifespan(bj_lastCreatedTextTag, 0.9)
call SetTextTagPermanent(bj_lastCreatedTextTag, FALSE)
if prefers then
call SetTextTagText(bj_lastCreatedTextTag, "I really want this one, " + I2S(udg_AH_Current_Price) + "!", 0.022)
else
call SetTextTagText(bj_lastCreatedTextTag, I2S(udg_AH_Current_Price), 0.022)
endif
call SaveUnitHandle(udg_AH_Hash, 0, StringHash("lastBidder"), u)
call TimerStart(udg_AH_Timer_Auctioneer, GetRandomReal(0.3,0.4), false, function AH_Hear_Bid)
else
set bj_lastCreatedTextTag = CreateTextTag()
call SetTextTagPosUnit(bj_lastCreatedTextTag, u, 0)
call SetTextTagFadepoint(bj_lastCreatedTextTag, 0.7)
call SetTextTagLifespan(bj_lastCreatedTextTag, 0.9)
call SetTextTagPermanent(bj_lastCreatedTextTag, FALSE)
call SetTextTagText(bj_lastCreatedTextTag, "Hmm...", 0.022)
endif
// Speed
call TimerStart(udg_AH_Timer_Bidders, GetRandomReal(2,3), false, function AH_Timer_Expire)
else
// call BJDebugMsg("max price reached")
endif
else
call TimerStart(udg_AH_Timer_Bidders, 0.1, false, function AH_Timer_Expire)
endif
else
call TimerStart(udg_AH_Timer_Bidders, 0.1, false, function AH_Timer_Expire)
endif
set u = null
endfunction
// Make own bids
function AH_Player_Bid takes nothing returns nothing
local integer bid = S2I(SubString(GetEventPlayerChatString(), 1, 6))
if bid > GetPlayerState(Player(0), PLAYER_STATE_RESOURCE_GOLD) then
set bid = GetPlayerState(Player(0), PLAYER_STATE_RESOURCE_GOLD)
endif
if bid > udg_AH_Current_Price then
set udg_AH_Current_Price = bid
call SaveUnitHandle(udg_AH_Hash, 0, StringHash("lastBidder"), udg_AH_Hero)
call TimerStart(udg_AH_Timer_Auctioneer, GetRandomReal(0.3,0.4), false, function AH_Hear_Bid)
// Speed
call TimerStart(udg_AH_Timer_Bidders, GetRandomReal(2, 3), false, function AH_Timer_Expire)
//call MultiboardSetItemValue(MultiboardGetItem(udg_AH_MB, 1, 0), GetUnitName(udg_AH_Hero) + ": " + I2S(udg_AH_Current_Price) + " Gold")
endif
endfunction
// Creates a new item to auction
function AH_New_Item takes nothing returns nothing
local integer i = GetRandomInt(1,3)
local integer rounds = LoadInteger(udg_AH_Hash, 0, StringHash("rounds"))
call RemoveSavedHandle(udg_AH_Hash, 0, StringHash("lastBidder"))
call RemoveSavedHandle(udg_AH_Hash, 0, StringHash("lastChosen"))
call SaveInteger(udg_AH_Hash, 0, StringHash("shoutCount"), 0)
call SaveInteger(udg_AH_Hash, 0, StringHash("rounds"), rounds - 1 )
call TriggerSleepAction(1.0)
if IsTriggerEnabled(udg_AH_Trig_Enter) then
return
endif
set bj_lastCreatedTextTag = CreateTextTag()
call SetTextTagPosUnit(bj_lastCreatedTextTag, udg_AH_Auctionists[0], 0)
call SetTextTagFadepoint(bj_lastCreatedTextTag, 1.5)
call SetTextTagLifespan(bj_lastCreatedTextTag, 2.0)
call SetTextTagPermanent(bj_lastCreatedTextTag, FALSE)
if i == 1 then
call SetTextTagText(bj_lastCreatedTextTag, "And our next item is...", 0.022)
elseif i == 2 then
call SetTextTagText(bj_lastCreatedTextTag, "What have we here...", 0.022)
else
call SetTextTagText(bj_lastCreatedTextTag, "Who's ready to bid for...", 0.022)
endif
call TriggerSleepAction(2.0)
if IsTriggerEnabled(udg_AH_Trig_Enter) then
return
endif
set bj_lastCreatedItem = PlaceRandomItem(LoadItemPoolHandle(udg_AH_Hash, 0, StringHash("itempool")), GetUnitX(udg_AH_Hero), GetUnitY(udg_AH_Hero))
set i = GetItemTypeId(bj_lastCreatedItem)
call UnitAddItem(udg_AH_Auctionists[0], bj_lastCreatedItem)
// Store the removed item type so it can be added to the item pool when auction ends
call SaveInteger(udg_AH_Hash, StringHash("items"), rounds, i)
call ItemPoolRemoveItemType(LoadItemPoolHandle(udg_AH_Hash, 0, StringHash("itempool")), i)
set udg_AH_Rounds = udg_AH_Rounds - 1
call SaveItemHandle(udg_AH_Hash, StringHash("lastItem"), 0, bj_lastCreatedItem)
set bj_lastCreatedTextTag = CreateTextTag()
call SetTextTagPosUnit(bj_lastCreatedTextTag, udg_AH_Auctionists[0], 0)
call SetTextTagFadepoint(bj_lastCreatedTextTag, 1.5)
call SetTextTagLifespan(bj_lastCreatedTextTag, 2.0)
call SetTextTagPermanent(bj_lastCreatedTextTag, FALSE)
call SetTextTagText(bj_lastCreatedTextTag, GetItemName(bj_lastCreatedItem) + "!", 0.022)
// Starting price
set udg_AH_Current_Price = R2I((LoadInteger(udg_AH_Hash, i, 1) * (1 + GetRandomReal(-0.25, 0.25))) / 2.5)
call MultiboardSetItemValue(MultiboardGetItem(udg_AH_MB, 0, 0), GetItemName(bj_lastCreatedItem))
call MultiboardSetItemValue(MultiboardGetItem(udg_AH_MB, 1, 0), "Starting price: " + I2S(udg_AH_Current_Price) + " Gold")
call MultiboardSetItemValue(MultiboardGetItem(udg_AH_MB, 2, 0), LoadStr(udg_AH_Hash, i, 3))
// Timer for bidder to make bids
call TimerStart(udg_AH_Timer_Bidders, GetRandomReal(1, 2), false, function AH_Timer_Expire)
call EnableTrigger(udg_AH_Trig_PlayerBid)
call EnableTrigger(udg_AH_Trig_Next)
endfunction
function AH_Menu_Dialog_Choise takes nothing returns nothing
if LoadInteger(udg_AH_Hash, GetHandleId(GetClickedButton()), 0) == 0 then
if LoadBoolean(udg_AH_Hash, 0, StringHash("timerResumeShout")) == true then
call ResumeTimer(udg_AH_Timer_Shout)
call SaveBoolean(udg_AH_Hash, 0, StringHash("timerResumeShout"), false)
endif
if LoadBoolean(udg_AH_Hash, 0, StringHash("timerResumeBid")) == true then
call ResumeTimer(udg_AH_Timer_Bidders)
call SaveBoolean(udg_AH_Hash, 0, StringHash("timerResumeBid"), false)
endif
//call MultiboardDisplay(xxx, false)
//call MultiboardDisplay(udg_AH_MB, true)
//call MultiboardMinimize(udg_AH_MB, true)
//call MultiboardMinimize(udg_AH_MB, false)
//* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Reset AH ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
if LoadBoolean(udg_AH_Hash, 0, StringHash("menuPause")) != true then
call SetUnitAnimationWithRarity( udg_AH_Auctionists[0], "stand", RARITY_FREQUENT )
call MultiboardSetItemValue(MultiboardGetItem(udg_AH_MB, 0, 0), null)
call MultiboardSetItemValue(MultiboardGetItem(udg_AH_MB, 1, 0), null)
call MultiboardSetItemValue(MultiboardGetItem(udg_AH_MB, 2, 0), null)
// Set rounds
call SaveInteger(udg_AH_Hash, 0, StringHash("rounds"), udg_AH_Rounds)
//call BJDebugMsg(I2S(LoadInteger(udg_AH_Hash, 0, StringHash("rounds"))))
call RemoveItem(UnitItemInSlot(udg_AH_Auctionists[0], 0))
call SaveInteger(udg_AH_Hash, GetHandleId(udg_AH_Auctionists[1]), StringHash("gold"), GetRandomInt(1000, 5000))
call SaveInteger(udg_AH_Hash, GetHandleId(udg_AH_Auctionists[2]), StringHash("gold"), GetRandomInt(1000, 5000))
call SaveInteger(udg_AH_Hash, GetHandleId(udg_AH_Auctionists[3]), StringHash("gold"), GetRandomInt(1000, 5000))
call SaveInteger(udg_AH_Hash, GetHandleId(udg_AH_Auctionists[4]), StringHash("gold"), GetRandomInt(1000, 5000))
//* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
call AH_New_Item()
else
call SaveBoolean(udg_AH_Hash, 0, StringHash("menuPause") , false)
endif
elseif LoadInteger(udg_AH_Hash, GetHandleId(GetClickedButton()), 0) == 2 then
call PauseTimer(udg_AH_Timer_Shout)
call PauseTimer(udg_AH_Timer_Bidders)
call AH_About()
else
call AH_Exit()
endif
endfunction
// Keeps the auctioneer selected
function AH_Deselect_Auctioneer takes nothing returns nothing
// 25 == selected, 24 = deselected
call TriggerSleepAction(0.2)
if GetHandleId(GetTriggerEventId()) == 25 and GetTriggerUnit() != udg_AH_Auctionists[0] then
call SelectUnit(GetTriggerUnit(), false)
elseif GetHandleId(GetTriggerEventId()) == 24 and GetTriggerUnit() == udg_AH_Auctionists[0] then
call SelectUnit(udg_AH_Auctionists[0], true)
endif
//call DisableTrigger(udg_AH_Trig_Selection)
//call ClearSelection()
//call SelectUnit(udg_AH_Auctionists[0], true)
//call EnableTrigger(udg_AH_Trig_Selection)
endfunction
function AH_Item_Next takes nothing returns nothing
local integer rounds
call DisableTrigger(udg_AH_Trig_Next)
call RemoveItem(LoadItemHandle(udg_AH_Hash, StringHash("lastItem"), 0))
call PauseTimer(udg_AH_Timer_Shout)
call PauseTimer(udg_AH_Timer_Bidders)
set rounds = LoadInteger(udg_AH_Hash, 0, StringHash("rounds")) - 1
call SaveInteger(udg_AH_Hash, 0, StringHash("shoutCount"), 0)
call SaveInteger(udg_AH_Hash, 0, StringHash("rounds"), rounds)
call ResetUnitLookAt(udg_AH_Auctionists[0])
if rounds <= 0 then
set bj_lastCreatedTextTag = CreateTextTag()
call SetTextTagPosUnit(bj_lastCreatedTextTag, udg_AH_Auctionists[0], 0)
call SetTextTagPermanent(bj_lastCreatedTextTag, FALSE)
call SetTextTagFadepoint(bj_lastCreatedTextTag, 1.7)
call SetTextTagLifespan(bj_lastCreatedTextTag, 2.0)
call SetTextTagText(bj_lastCreatedTextTag, "That's all we have for now.", 0.022)
call AH_Exit()
else
call ResetUnitLookAt(udg_AH_Auctionists[0])
call TimerStart(udg_AH_Timer_NewItem, 1, false, null)
endif
endfunction
// Creates dialogs
function AH_Setup_Dialog takes nothing returns nothing
set udg_AH_Trig_Menu_Choise = CreateTrigger()
set bj_lastCreatedButton = DialogAddButton(udg_AH_Enter_Dialog, "|cffffcc00Y|res", 'Y')
call SaveInteger(udg_AH_Hash, GetHandleId(bj_lastCreatedButton), 0, 0)
set bj_lastCreatedButton = DialogAddButton(udg_AH_Enter_Dialog, "|cffffcc00N|ro", 'N')
call SaveInteger(udg_AH_Hash, GetHandleId(bj_lastCreatedButton), 0, 1)
set bj_lastCreatedButton = DialogAddButton(udg_AH_Exit_Dialog, "|cffffcc00Y|res", 'Y')
call SaveInteger(udg_AH_Hash, GetHandleId(bj_lastCreatedButton), 0, 1)
set bj_lastCreatedButton = DialogAddButton(udg_AH_Exit_Dialog, "|cffffcc00N|ro", 'N')
call SaveInteger(udg_AH_Hash, GetHandleId(bj_lastCreatedButton), 0, 0)
set bj_lastCreatedButton = DialogAddButton(udg_AH_Exit_Dialog, "|cffffcc00I|rnfo", 'I')
call SaveInteger(udg_AH_Hash, GetHandleId(bj_lastCreatedButton), 0, 2)
call TriggerRegisterDialogEvent(udg_AH_Trig_Menu_Choise, udg_AH_Enter_Dialog)
call TriggerRegisterDialogEvent(udg_AH_Trig_Menu_Choise, udg_AH_Exit_Dialog)
call TriggerAddAction(udg_AH_Trig_Menu_Choise, function AH_Menu_Dialog_Choise)
endfunction
// Creates multiboard
function AH_Setup_MB takes nothing returns nothing
set udg_AH_MB = CreateMultiboard()
call MultiboardSetRowCount(udg_AH_MB, 3)
call MultiboardSetColumnCount(udg_AH_MB, 1)
call MultiboardSetTitleText(udg_AH_MB, "AUCTION HALL")
call MultiboardSetTitleTextColor(udg_AH_MB, 255, 215, 0, 0)
call MultiboardSetItemsStyle(udg_AH_MB, true, false)
call MultiboardSetItemsWidth(udg_AH_MB, 0.25)
call MultiboardSetItemsValueColor(udg_AH_MB, 127, 255, 212, 0)
endfunction
// Prevents the hero from responding to orders while in AH
function AH_Stop_Hero takes nothing returns nothing
call DisableTrigger(udg_AH_Pause_Hero)
//call BJDebugMsg("not stop")
call PauseUnit(udg_AH_Hero, true)
call SetUnitPosition(udg_AH_Hero, GetUnitX(udg_AH_Hero), GetUnitY(udg_AH_Hero))
call PauseUnit(udg_AH_Hero, false)
call EnableTrigger(udg_AH_Pause_Hero)
endfunction
function AH_Menu takes nothing returns nothing
if TimerGetRemaining(udg_AH_Timer_Shout) > 0 then
call PauseTimer(udg_AH_Timer_Shout)
call SaveBoolean(udg_AH_Hash, 0, StringHash("timerResumeShout"), true)
endif
if TimerGetRemaining(udg_AH_Timer_Bidders) > 0 then
call PauseTimer(udg_AH_Timer_Bidders)
call SaveBoolean(udg_AH_Hash, 0, StringHash("timerResumeBid"), true)
endif
call SaveBoolean(udg_AH_Hash, 0, StringHash("menuPause"), true)
//call AH_Cin(false, 0.3)
//call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 0.30, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
//call TriggerSleepAction(0.4)
call DialogSetMessage(udg_AH_Exit_Dialog, "Exit the Auction Hall?")
call DialogDisplay(Player(0), udg_AH_Exit_Dialog, true)
endfunction
// Enter the Auction Hall area
function AH_Enter takes nothing returns nothing
set udg_AH_Hero = GetTriggerUnit()
call DisableTrigger(udg_AH_Trig_Enter)
call AH_Cin(false, 0.5)
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 0.50, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
if udg_AH_MB == null then
call AH_Setup_MB()
endif
call SaveBoolean(udg_AH_Hash, 0, StringHash("menuPause"), false)
call SaveBoolean(udg_AH_Hash, 0, StringHash("timerResumeBid"), false)
call SaveBoolean(udg_AH_Hash, 0, StringHash("timerResumeShout"), false)
call TriggerSleepAction(0.3)
call EnableSelect( false, false )
call EnableDragSelect( false, false )
call ClearSelection()
call SelectUnit(udg_AH_Auctionists[0], true)
call SetUnitPositionLoc(udg_AH_Hero, udg_AH_Hero_Point)
call CameraSetupApplyForceDuration(udg_AH_Enter_Cam, true, 0)
call AH_Cin(true, 0.3)
//call SetCameraBoundsToRect(udg_AH_Cam_Bounds)
call SetCameraBounds(GetRectCenterX(udg_AH_Cam_Bounds), GetRectCenterY(udg_AH_Cam_Bounds), GetRectCenterX(udg_AH_Cam_Bounds), GetRectCenterY(udg_AH_Cam_Bounds), GetRectCenterX(udg_AH_Cam_Bounds), GetRectCenterY(udg_AH_Cam_Bounds),GetRectCenterX(udg_AH_Cam_Bounds), GetRectCenterY(udg_AH_Cam_Bounds))
call EnableTrigger(udg_AH_Trig_Menu)
call EnableTrigger(udg_AH_Pause_Hero)
call EnableTrigger(udg_AH_Trig_Selection)
call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 0.30, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, 0, 0, 0 )
call AH_Menu_Dialog_Choise()
//call DialogSetMessage(udg_AH_Enter_Dialog, "Enter the Auction Hall?")
//call DialogDisplay(Player(0), udg_AH_Enter_Dialog, true)
endfunction
// Initialization
function InitTrig_Auction_Hall takes nothing returns nothing
local region enter = CreateRegion()
set udg_AH_Hash = InitHashtable()
call AH_Setup()
call AH_Setup_Dialog()
call RegionAddRect(enter, udg_AH_Enter_Rect)
set udg_AH_Trig_Menu = CreateTrigger()
set udg_AH_Trig_Enter = CreateTrigger()
set udg_AH_Pause_Hero = CreateTrigger()
set udg_AH_Trig_Next = CreateTrigger()
set udg_AH_Trig_NewItem = CreateTrigger()
set udg_AH_Trig_PlayerBid = CreateTrigger()
set udg_AH_Trig_Selection = CreateTrigger()
call TriggerRegisterEnterRegion(udg_AH_Trig_Enter, enter, null)
call TriggerAddAction(udg_AH_Trig_Enter, function AH_Enter)
call TriggerRegisterPlayerEvent(udg_AH_Trig_Menu, Player(0), EVENT_PLAYER_END_CINEMATIC)
call TriggerAddAction(udg_AH_Trig_Menu, function AH_Menu)
call TriggerRegisterPlayerUnitEvent(udg_AH_Pause_Hero, Player(0), EVENT_PLAYER_UNIT_ISSUED_ORDER, null)
call TriggerRegisterPlayerUnitEvent(udg_AH_Pause_Hero, Player(0), EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER, null)
call TriggerRegisterPlayerUnitEvent(udg_AH_Pause_Hero, Player(0), EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER, null)
call TriggerAddAction(udg_AH_Pause_Hero, function AH_Stop_Hero)
call TriggerRegisterPlayerChatEvent(udg_AH_Trig_PlayerBid, Player(0), "-", false)
call TriggerAddAction(udg_AH_Trig_PlayerBid, function AH_Player_Bid)
call TriggerRegisterTimerExpireEvent(udg_AH_Trig_NewItem, udg_AH_Timer_NewItem)
call TriggerAddAction(udg_AH_Trig_NewItem, function AH_New_Item)
call TriggerRegisterPlayerEvent(udg_AH_Trig_Next, Player(0), EVENT_PLAYER_ARROW_RIGHT_DOWN)
call TriggerAddAction(udg_AH_Trig_Next, function AH_Item_Next)
//call TriggerRegisterPlayerUnitEvent(udg_AH_Trig_Selection, Player(0), EVENT_PLAYER_UNIT_DESELECTED, null)
//call TriggerRegisterPlayerUnitEvent(udg_AH_Trig_Selection, Player(0), EVENT_PLAYER_UNIT_SELECTED, null)
//call TriggerAddAction(udg_AH_Trig_Selection, function AH_Deselect_Auctioneer)
call DisableTrigger(udg_AH_Trig_Next)
call DisableTrigger(udg_AH_Trig_Menu)
call DisableTrigger(udg_AH_Pause_Hero)
call DisableTrigger(udg_AH_Trig_PlayerBid)
call DisableTrigger(udg_AH_Trig_Selection)
set enter = null
endfunction
Rep for the helper. Map is attached to the post.