pokeemerald/data/scripts/obtain_item.inc
2021-11-17 22:00:44 -05:00

211 lines
5.2 KiB
PHP

.set ITEMID, VAR_0x8000
.set AMOUNT, VAR_0x8001
Std_ObtainItem::
additem ITEMID, AMOUNT
copyvar VAR_0x8007, VAR_RESULT
call EventScript_ObtainItemMessage
return
EventScript_ObtainItemMessage::
bufferitemnameplural STR_VAR_2, ITEMID, AMOUNT
checkitemtype ITEMID
call EventScript_BufferPocketNameAndTryFanfare
compare VAR_0x8007, TRUE
call_if_eq EventScript_ObtainedItem
compare VAR_0x8007, FALSE
call_if_eq EventScript_NoRoomForItem
return
EventScript_BufferPocketNameAndTryFanfare::
switch VAR_RESULT
case POCKET_ITEMS, EventScript_BufferItemsPocket
case POCKET_KEY_ITEMS, EventScript_BufferKeyItemsPocket
case POCKET_POKE_BALLS, EventScript_BufferPokeballsPocket
case POCKET_TM_HM, EventScript_BufferTMHMsPocket
case POCKET_BERRIES, EventScript_BufferBerriesPocket
end
EventScript_BufferItemsPocket::
bufferstdstring STR_VAR_3, STDSTRING_ITEMS
compare VAR_0x8007, TRUE
call_if_eq EventScript_PlayFanfareObtainedItem
return
EventScript_BufferKeyItemsPocket::
bufferstdstring STR_VAR_3, STDSTRING_KEYITEMS
compare VAR_0x8007, TRUE
call_if_eq EventScript_PlayFanfareObtainedItem
return
EventScript_BufferPokeballsPocket::
bufferstdstring STR_VAR_3, STDSTRING_POKEBALLS
compare VAR_0x8007, TRUE
call_if_eq EventScript_PlayFanfareObtainedItem
return
EventScript_BufferTMHMsPocket::
bufferstdstring STR_VAR_3, STDSTRING_TMHMS
compare VAR_0x8007, TRUE
call_if_eq EventScript_PlayFanfareObtainedTMHM
return
EventScript_BufferBerriesPocket::
bufferstdstring STR_VAR_3, STDSTRING_BERRIES
compare VAR_0x8007, TRUE
call_if_eq EventScript_PlayFanfareObtainedItem
return
EventScript_ObtainedItem::
message gText_ObtainedTheItem
waitfanfare
msgbox gText_PutItemInPocket, MSGBOX_DEFAULT
setvar VAR_RESULT, TRUE
return
EventScript_NoRoomForItem::
setvar VAR_RESULT, FALSE
return
EventScript_PlayFanfareObtainedItem::
playfanfare MUS_OBTAIN_ITEM
return
EventScript_PlayFanfareObtainedTMHM::
playfanfare MUS_OBTAIN_TMHM
return
Std_ObtainDecoration::
adddecoration ITEMID
copyvar VAR_0x8007, VAR_RESULT
call EventScript_ObtainDecorationMessage
return
EventScript_ObtainDecorationMessage::
bufferdecorationname STR_VAR_2, ITEMID
compare VAR_0x8007, TRUE
call_if_eq EventScript_ObtainedDecor
compare VAR_0x8007, FALSE
call_if_eq EventScript_NoRoomForDecor
return
EventScript_ObtainedDecor::
playfanfare MUS_OBTAIN_ITEM
message gText_ObtainedTheDecor
waitfanfare
msgbox gText_TheDecorWasTransferredToThePC, MSGBOX_DEFAULT
setvar VAR_RESULT, TRUE
return
EventScript_NoRoomForDecor::
setvar VAR_RESULT, FALSE
return
Std_FindItem::
lock
faceplayer
waitse
copyvar VAR_0x8004, ITEMID
copyvar VAR_0x8005, AMOUNT
checkitemspace ITEMID, AMOUNT
copyvar VAR_0x8007, VAR_RESULT
bufferitemnameplural STR_VAR_2, ITEMID, AMOUNT
checkitemtype ITEMID
call EventScript_BufferPocketNameAndTryFanfare
compare VAR_0x8007, TRUE
call_if_eq EventScript_PickUpItem
compare VAR_0x8007, FALSE
call_if_eq EventScript_NoRoomToPickUpItem
release
return
EventScript_PickUpItem::
removeobject VAR_LAST_TALKED
additem VAR_0x8004, VAR_0x8005
specialvar VAR_RESULT, BufferTMHMMoveName
copyvar VAR_0x8008, VAR_RESULT
compare VAR_0x8008, TRUE
call_if_eq EventScript_FoundTMHM
compare VAR_0x8008, FALSE
call_if_eq EventScript_FoundItem
waitfanfare
waitmessage
bufferitemnameplural STR_VAR_2, VAR_0x8004, VAR_0x8005
pyramid_inchallenge
compare VAR_RESULT, TRUE
goto_if_eq EventScript_PutBattlePyramidItemInBag
msgbox gText_PutItemInPocket, MSGBOX_DEFAULT
return
EventScript_PutBattlePyramidItemInBag::
msgbox gText_PlayerPutItemInBag, MSGBOX_DEFAULT
return
EventScript_FoundTMHM::
bufferitemnameplural STR_VAR_1, VAR_0x8004, VAR_0x8005
message gText_PlayerFoundOneTMHM
return
EventScript_FoundItem::
message gText_PlayerFoundOneItem
return
EventScript_NoRoomToPickUpItem::
msgbox gText_ObtainedTheItem, MSGBOX_DEFAULT
msgbox gText_TooBadBagIsFull, MSGBOX_DEFAULT
setvar VAR_RESULT, FALSE
return
EventScript_HiddenItemScript::
lockall
waitse
additem VAR_0x8005
copyvar VAR_0x8007, VAR_RESULT
bufferitemnameplural STR_VAR_2, VAR_0x8005, 1
checkitemtype VAR_0x8005
call EventScript_BufferPocketNameAndTryFanfare
compare VAR_0x8007, TRUE
goto_if_eq EventScript_PickUpHiddenItem
compare VAR_0x8007, FALSE
goto_if_eq EventScript_NoRoomForHiddenItem
end
EventScript_PickUpHiddenItem::
copyvar VAR_0x8008, VAR_0x8004
copyvar VAR_0x8004, VAR_0x8005
specialvar VAR_RESULT, BufferTMHMMoveName
compare VAR_RESULT, TRUE
goto_if_eq EventScript_FoundHiddenTMHM
compare VAR_RESULT, FALSE
goto_if_eq EventScript_FoundHiddenItem
end
EventScript_FoundHiddenTMHM::
bufferitemnameplural STR_VAR_1, VAR_0x8004, 1
message gText_PlayerFoundOneTMHM
goto EventScript_PutHiddenItemInPocket
end
EventScript_FoundHiddenItem::
message gText_PlayerFoundOneItem
goto EventScript_PutHiddenItemInPocket
end
EventScript_PutHiddenItemInPocket::
waitmessage
waitfanfare
bufferitemnameplural STR_VAR_2, VAR_0x8004, 1
copyvar VAR_0x8004, VAR_0x8008
msgbox gText_PutItemInPocket, MSGBOX_DEFAULT
special TryPutTreasureInvestigatorsOnAir
special SetHiddenItemFlag
releaseall
end
EventScript_NoRoomForHiddenItem::
msgbox gText_PlayerFoundOneItem, MSGBOX_DEFAULT
msgbox gText_TooBadBagIsFull, MSGBOX_DEFAULT
setvar VAR_RESULT, 0
releaseall
end