2018-06-24 14:09:41 +00:00
|
|
|
|
NPCTrade::
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld a, e
|
|
|
|
|
ld [wJumptableIndex], a
|
2015-11-23 05:21:21 +00:00
|
|
|
|
call Trade_GetDialog
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld b, CHECK_FLAG
|
|
|
|
|
call TradeFlagAction
|
2018-02-01 02:16:57 +00:00
|
|
|
|
ld a, TRADE_DIALOG_AFTER
|
2015-11-19 23:07:20 +00:00
|
|
|
|
jr nz, .done
|
|
|
|
|
|
2018-02-01 02:16:57 +00:00
|
|
|
|
ld a, TRADE_DIALOG_INTRO
|
2015-11-19 23:07:20 +00:00
|
|
|
|
call PrintTradeText
|
|
|
|
|
|
|
|
|
|
call YesNoBox
|
2018-02-01 02:16:57 +00:00
|
|
|
|
ld a, TRADE_DIALOG_CANCEL
|
2015-11-19 23:07:20 +00:00
|
|
|
|
jr c, .done
|
|
|
|
|
|
|
|
|
|
; Select givemon from party
|
2017-11-30 19:27:25 +00:00
|
|
|
|
ld b, PARTYMENUACTION_GIVE_MON
|
2017-12-24 17:47:30 +00:00
|
|
|
|
farcall SelectTradeOrDayCareMon
|
2018-02-01 02:16:57 +00:00
|
|
|
|
ld a, TRADE_DIALOG_CANCEL
|
2015-11-19 23:07:20 +00:00
|
|
|
|
jr c, .done
|
|
|
|
|
|
2018-02-01 02:16:57 +00:00
|
|
|
|
ld e, NPCTRADE_GIVEMON
|
2015-11-19 23:07:20 +00:00
|
|
|
|
call GetTradeAttribute
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld a, [wCurPartySpecies]
|
2015-11-19 23:07:20 +00:00
|
|
|
|
cp [hl]
|
2018-02-01 02:16:57 +00:00
|
|
|
|
ld a, TRADE_DIALOG_WRONG
|
2015-11-19 23:07:20 +00:00
|
|
|
|
jr nz, .done
|
|
|
|
|
|
|
|
|
|
call CheckTradeGender
|
2018-02-01 02:16:57 +00:00
|
|
|
|
ld a, TRADE_DIALOG_WRONG
|
2015-11-19 23:07:20 +00:00
|
|
|
|
jr c, .done
|
|
|
|
|
|
|
|
|
|
ld b, SET_FLAG
|
|
|
|
|
call TradeFlagAction
|
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
|
ld hl, NPCTradeCableText
|
2015-11-19 23:07:20 +00:00
|
|
|
|
call PrintText
|
|
|
|
|
|
2015-11-23 05:21:21 +00:00
|
|
|
|
call DoNPCTrade
|
|
|
|
|
call .TradeAnimation
|
2015-11-19 23:07:20 +00:00
|
|
|
|
call GetTradeMonNames
|
|
|
|
|
|
|
|
|
|
ld hl, TradedForText
|
|
|
|
|
call PrintText
|
|
|
|
|
|
|
|
|
|
call RestartMapMusic
|
|
|
|
|
|
2018-02-01 02:16:57 +00:00
|
|
|
|
ld a, TRADE_DIALOG_COMPLETE
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
|
|
|
|
.done
|
|
|
|
|
call PrintTradeText
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
.TradeAnimation:
|
2015-11-19 23:07:20 +00:00
|
|
|
|
call DisableSpriteUpdates
|
|
|
|
|
ld a, [wJumptableIndex]
|
|
|
|
|
push af
|
|
|
|
|
ld a, [wcf64]
|
|
|
|
|
push af
|
2018-01-16 19:30:10 +00:00
|
|
|
|
predef TradeAnimation
|
2015-11-19 23:07:20 +00:00
|
|
|
|
pop af
|
|
|
|
|
ld [wcf64], a
|
|
|
|
|
pop af
|
|
|
|
|
ld [wJumptableIndex], a
|
2015-12-19 01:07:09 +00:00
|
|
|
|
call ReturnToMapWithSpeechTextbox
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
CheckTradeGender:
|
2015-11-19 23:07:20 +00:00
|
|
|
|
xor a
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld [wMonType], a
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2018-02-01 02:16:57 +00:00
|
|
|
|
ld e, NPCTRADE_GENDER
|
2015-11-19 23:07:20 +00:00
|
|
|
|
call GetTradeAttribute
|
|
|
|
|
ld a, [hl]
|
2018-02-01 02:16:57 +00:00
|
|
|
|
and a ; TRADE_GENDER_EITHER
|
2015-12-14 01:33:56 +00:00
|
|
|
|
jr z, .matching
|
2018-02-01 02:16:57 +00:00
|
|
|
|
cp TRADE_GENDER_MALE
|
2015-12-14 01:33:56 +00:00
|
|
|
|
jr z, .check_male
|
2018-02-01 02:16:57 +00:00
|
|
|
|
; TRADE_GENDER_FEMALE
|
2018-01-16 19:30:10 +00:00
|
|
|
|
farcall GetGender
|
2015-12-14 01:33:56 +00:00
|
|
|
|
jr nz, .not_matching
|
|
|
|
|
jr .matching
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2015-12-14 01:33:56 +00:00
|
|
|
|
.check_male
|
2018-01-16 19:30:10 +00:00
|
|
|
|
farcall GetGender
|
2015-12-14 01:33:56 +00:00
|
|
|
|
jr z, .not_matching
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2015-12-14 01:33:56 +00:00
|
|
|
|
.matching
|
2015-11-19 23:07:20 +00:00
|
|
|
|
and a
|
|
|
|
|
ret
|
|
|
|
|
|
2015-12-14 01:33:56 +00:00
|
|
|
|
.not_matching
|
2015-11-19 23:07:20 +00:00
|
|
|
|
scf
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
TradeFlagAction:
|
2015-11-23 05:21:21 +00:00
|
|
|
|
ld hl, wTradeFlags
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld a, [wJumptableIndex]
|
|
|
|
|
ld c, a
|
2018-01-16 19:30:10 +00:00
|
|
|
|
predef SmallFarFlagAction
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld a, c
|
|
|
|
|
and a
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
Trade_GetDialog:
|
2018-02-01 02:16:57 +00:00
|
|
|
|
ld e, NPCTRADE_DIALOG
|
2015-11-19 23:07:20 +00:00
|
|
|
|
call GetTradeAttribute
|
|
|
|
|
ld a, [hl]
|
|
|
|
|
ld [wcf64], a
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
DoNPCTrade:
|
2018-02-01 02:16:57 +00:00
|
|
|
|
ld e, NPCTRADE_GIVEMON
|
2015-11-19 23:07:20 +00:00
|
|
|
|
call GetTradeAttribute
|
|
|
|
|
ld a, [hl]
|
2015-11-23 05:21:21 +00:00
|
|
|
|
ld [wPlayerTrademonSpecies], a
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2018-02-01 02:16:57 +00:00
|
|
|
|
ld e, NPCTRADE_GETMON
|
2015-11-19 23:07:20 +00:00
|
|
|
|
call GetTradeAttribute
|
|
|
|
|
ld a, [hl]
|
2015-11-23 05:21:21 +00:00
|
|
|
|
ld [wOTTrademonSpecies], a
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2015-11-23 05:21:21 +00:00
|
|
|
|
ld a, [wPlayerTrademonSpecies]
|
|
|
|
|
ld de, wPlayerTrademonSpeciesName
|
|
|
|
|
call GetTradeMonName
|
|
|
|
|
call CopyTradeName
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2015-11-23 05:21:21 +00:00
|
|
|
|
ld a, [wOTTrademonSpecies]
|
|
|
|
|
ld de, wOTTrademonSpeciesName
|
|
|
|
|
call GetTradeMonName
|
|
|
|
|
call CopyTradeName
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld hl, wPartyMonOT
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld bc, NAME_LENGTH
|
2015-11-23 05:21:21 +00:00
|
|
|
|
call Trade_GetAttributeOfCurrentPartymon
|
|
|
|
|
ld de, wPlayerTrademonOTName
|
|
|
|
|
call CopyTradeName
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld hl, wPlayerName
|
2015-11-23 05:21:21 +00:00
|
|
|
|
ld de, wPlayerTrademonSenderName
|
|
|
|
|
call CopyTradeName
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld hl, wPartyMon1ID
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
2015-11-23 05:21:21 +00:00
|
|
|
|
call Trade_GetAttributeOfCurrentPartymon
|
|
|
|
|
ld de, wPlayerTrademonID
|
|
|
|
|
call Trade_CopyTwoBytes
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld hl, wPartyMon1DVs
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
2015-11-23 05:21:21 +00:00
|
|
|
|
call Trade_GetAttributeOfCurrentPartymon
|
|
|
|
|
ld de, wPlayerTrademonDVs
|
|
|
|
|
call Trade_CopyTwoBytes
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld hl, wPartyMon1Species
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
2015-11-23 05:21:21 +00:00
|
|
|
|
call Trade_GetAttributeOfCurrentPartymon
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld b, h
|
|
|
|
|
ld c, l
|
2017-12-24 17:47:30 +00:00
|
|
|
|
farcall GetCaughtGender
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld a, c
|
2015-11-23 05:21:21 +00:00
|
|
|
|
ld [wPlayerTrademonCaughtData], a
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2018-02-01 02:16:57 +00:00
|
|
|
|
ld e, NPCTRADE_DIALOG
|
2015-11-19 23:07:20 +00:00
|
|
|
|
call GetTradeAttribute
|
|
|
|
|
ld a, [hl]
|
2018-02-01 02:16:57 +00:00
|
|
|
|
cp TRADE_DIALOGSET_GIRL
|
2018-01-11 17:00:01 +00:00
|
|
|
|
ld a, CAUGHT_BY_GIRL
|
2015-11-23 05:21:21 +00:00
|
|
|
|
jr c, .okay
|
2018-01-11 17:00:01 +00:00
|
|
|
|
ld a, CAUGHT_BY_BOY
|
2015-11-23 05:21:21 +00:00
|
|
|
|
.okay
|
|
|
|
|
ld [wOTTrademonCaughtData], a
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld hl, wPartyMon1Level
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
2015-11-23 05:21:21 +00:00
|
|
|
|
call Trade_GetAttributeOfCurrentPartymon
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld a, [hl]
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld [wCurPartyLevel], a
|
2015-11-23 05:21:21 +00:00
|
|
|
|
ld a, [wOTTrademonSpecies]
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld [wCurPartySpecies], a
|
2015-11-19 23:07:20 +00:00
|
|
|
|
xor a
|
2018-02-22 20:35:11 +00:00
|
|
|
|
ld [wMonType], a ; PARTYMON
|
|
|
|
|
ld [wPokemonWithdrawDepositParameter], a ; REMOVE_PARTY
|
2017-12-24 17:47:30 +00:00
|
|
|
|
callfar RemoveMonFromPartyOrBox
|
2018-01-16 19:30:10 +00:00
|
|
|
|
predef TryAddMonToParty
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2018-02-01 02:16:57 +00:00
|
|
|
|
ld e, NPCTRADE_DIALOG
|
2015-11-19 23:07:20 +00:00
|
|
|
|
call GetTradeAttribute
|
|
|
|
|
ld a, [hl]
|
2020-07-25 22:36:49 +00:00
|
|
|
|
cp TRADE_DIALOGSET_GIRL
|
|
|
|
|
ld b, CAUGHT_BY_UNKNOWN
|
2015-12-14 01:33:56 +00:00
|
|
|
|
jr c, .incomplete
|
2020-07-25 22:36:49 +00:00
|
|
|
|
ld b, CAUGHT_BY_GIRL
|
2015-12-14 01:33:56 +00:00
|
|
|
|
.incomplete
|
2017-12-24 17:47:30 +00:00
|
|
|
|
farcall SetGiftPartyMonCaughtData
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2018-02-01 02:16:57 +00:00
|
|
|
|
ld e, NPCTRADE_NICK
|
2015-11-19 23:07:20 +00:00
|
|
|
|
call GetTradeAttribute
|
2015-11-23 05:21:21 +00:00
|
|
|
|
ld de, wOTTrademonNickname
|
|
|
|
|
call CopyTradeName
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld hl, wPartyMonNicknames
|
2018-01-20 17:25:55 +00:00
|
|
|
|
ld bc, MON_NAME_LENGTH
|
2015-11-23 05:21:21 +00:00
|
|
|
|
call Trade_GetAttributeOfLastPartymon
|
|
|
|
|
ld hl, wOTTrademonNickname
|
|
|
|
|
call CopyTradeName
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2018-02-01 02:16:57 +00:00
|
|
|
|
ld e, NPCTRADE_OT_NAME
|
2015-11-19 23:07:20 +00:00
|
|
|
|
call GetTradeAttribute
|
|
|
|
|
push hl
|
2015-11-23 05:21:21 +00:00
|
|
|
|
ld de, wOTTrademonOTName
|
|
|
|
|
call CopyTradeName
|
2015-11-19 23:07:20 +00:00
|
|
|
|
pop hl
|
2015-11-23 05:21:21 +00:00
|
|
|
|
ld de, wOTTrademonSenderName
|
|
|
|
|
call CopyTradeName
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld hl, wPartyMonOT
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld bc, NAME_LENGTH
|
2015-11-23 05:21:21 +00:00
|
|
|
|
call Trade_GetAttributeOfLastPartymon
|
|
|
|
|
ld hl, wOTTrademonOTName
|
|
|
|
|
call CopyTradeName
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2018-02-01 02:16:57 +00:00
|
|
|
|
ld e, NPCTRADE_DVS
|
2015-11-19 23:07:20 +00:00
|
|
|
|
call GetTradeAttribute
|
2015-11-23 05:21:21 +00:00
|
|
|
|
ld de, wOTTrademonDVs
|
|
|
|
|
call Trade_CopyTwoBytes
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld hl, wPartyMon1DVs
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
2015-11-23 05:21:21 +00:00
|
|
|
|
call Trade_GetAttributeOfLastPartymon
|
|
|
|
|
ld hl, wOTTrademonDVs
|
|
|
|
|
call Trade_CopyTwoBytes
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2018-02-01 02:16:57 +00:00
|
|
|
|
ld e, NPCTRADE_OT_ID
|
2015-11-19 23:07:20 +00:00
|
|
|
|
call GetTradeAttribute
|
2015-11-23 05:21:21 +00:00
|
|
|
|
ld de, wOTTrademonID + 1
|
|
|
|
|
call Trade_CopyTwoBytesReverseEndian
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld hl, wPartyMon1ID
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
2015-11-23 05:21:21 +00:00
|
|
|
|
call Trade_GetAttributeOfLastPartymon
|
|
|
|
|
ld hl, wOTTrademonID
|
|
|
|
|
call Trade_CopyTwoBytes
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2018-02-01 02:16:57 +00:00
|
|
|
|
ld e, NPCTRADE_ITEM
|
2015-11-19 23:07:20 +00:00
|
|
|
|
call GetTradeAttribute
|
|
|
|
|
push hl
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld hl, wPartyMon1Item
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
2015-11-23 05:21:21 +00:00
|
|
|
|
call Trade_GetAttributeOfLastPartymon
|
2015-11-19 23:07:20 +00:00
|
|
|
|
pop hl
|
|
|
|
|
ld a, [hl]
|
|
|
|
|
ld [de], a
|
|
|
|
|
|
|
|
|
|
push af
|
|
|
|
|
push bc
|
|
|
|
|
push de
|
|
|
|
|
push hl
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld a, [wCurPartyMon]
|
2015-11-19 23:07:20 +00:00
|
|
|
|
push af
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld a, [wPartyCount]
|
2015-11-19 23:07:20 +00:00
|
|
|
|
dec a
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld [wCurPartyMon], a
|
2017-12-24 17:47:30 +00:00
|
|
|
|
farcall ComputeNPCTrademonStats
|
2015-11-19 23:07:20 +00:00
|
|
|
|
pop af
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld [wCurPartyMon], a
|
2015-11-19 23:07:20 +00:00
|
|
|
|
pop hl
|
|
|
|
|
pop de
|
|
|
|
|
pop bc
|
|
|
|
|
pop af
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
|
GetTradeAttribute:
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld d, 0
|
|
|
|
|
push de
|
|
|
|
|
ld a, [wJumptableIndex]
|
|
|
|
|
and $f
|
|
|
|
|
swap a
|
|
|
|
|
ld e, a
|
|
|
|
|
ld d, 0
|
|
|
|
|
ld hl, NPCTrades
|
|
|
|
|
add hl, de
|
2016-05-04 15:46:23 +00:00
|
|
|
|
add hl, de
|
2015-11-19 23:07:20 +00:00
|
|
|
|
pop de
|
|
|
|
|
add hl, de
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
Trade_GetAttributeOfCurrentPartymon:
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld a, [wCurPartyMon]
|
2015-11-19 23:07:20 +00:00
|
|
|
|
call AddNTimes
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
Trade_GetAttributeOfLastPartymon:
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld a, [wPartyCount]
|
2015-11-19 23:07:20 +00:00
|
|
|
|
dec a
|
|
|
|
|
call AddNTimes
|
|
|
|
|
ld e, l
|
|
|
|
|
ld d, h
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
GetTradeMonName:
|
2015-11-19 23:07:20 +00:00
|
|
|
|
push de
|
2018-07-28 23:27:34 +00:00
|
|
|
|
ld [wNamedObjectIndexBuffer], a
|
2015-11-19 23:07:20 +00:00
|
|
|
|
call GetBasePokemonName
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld hl, wStringBuffer1
|
2015-11-19 23:07:20 +00:00
|
|
|
|
pop de
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
CopyTradeName:
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld bc, NAME_LENGTH
|
|
|
|
|
call CopyBytes
|
|
|
|
|
ret
|
|
|
|
|
|
2020-06-21 20:27:43 +00:00
|
|
|
|
Functionfcdfb: ; unreferenced
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld bc, 4
|
|
|
|
|
call CopyBytes
|
2015-11-23 05:21:21 +00:00
|
|
|
|
ld a, "@"
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld [de], a
|
|
|
|
|
ret
|
|
|
|
|
|
2020-06-21 20:27:43 +00:00
|
|
|
|
Functionfce05: ; unreferenced
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld bc, 3
|
|
|
|
|
call CopyBytes
|
2015-11-23 05:21:21 +00:00
|
|
|
|
ld a, "@"
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld [de], a
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
Trade_CopyTwoBytes:
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld a, [hli]
|
|
|
|
|
ld [de], a
|
|
|
|
|
inc de
|
|
|
|
|
ld a, [hl]
|
|
|
|
|
ld [de], a
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
Trade_CopyTwoBytesReverseEndian:
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld a, [hli]
|
|
|
|
|
ld [de], a
|
|
|
|
|
dec de
|
|
|
|
|
ld a, [hl]
|
|
|
|
|
ld [de], a
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
GetTradeMonNames:
|
2018-02-01 02:16:57 +00:00
|
|
|
|
ld e, NPCTRADE_GETMON
|
2015-11-19 23:07:20 +00:00
|
|
|
|
call GetTradeAttribute
|
|
|
|
|
ld a, [hl]
|
2015-11-23 05:21:21 +00:00
|
|
|
|
call GetTradeMonName
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld de, wStringBuffer2
|
2015-11-23 05:21:21 +00:00
|
|
|
|
call CopyTradeName
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2018-02-01 02:16:57 +00:00
|
|
|
|
ld e, NPCTRADE_GIVEMON
|
2015-11-19 23:07:20 +00:00
|
|
|
|
call GetTradeAttribute
|
|
|
|
|
ld a, [hl]
|
2015-11-23 05:21:21 +00:00
|
|
|
|
call GetTradeMonName
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2015-12-19 01:07:09 +00:00
|
|
|
|
ld de, wMonOrItemNameBuffer
|
2015-11-23 05:21:21 +00:00
|
|
|
|
call CopyTradeName
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
|
ld hl, wStringBuffer1
|
2015-11-19 23:07:20 +00:00
|
|
|
|
.loop
|
|
|
|
|
ld a, [hli]
|
|
|
|
|
cp "@"
|
|
|
|
|
jr nz, .loop
|
|
|
|
|
|
|
|
|
|
dec hl
|
|
|
|
|
push hl
|
2018-02-01 02:16:57 +00:00
|
|
|
|
ld e, NPCTRADE_GENDER
|
2015-11-19 23:07:20 +00:00
|
|
|
|
call GetTradeAttribute
|
|
|
|
|
ld a, [hl]
|
|
|
|
|
pop hl
|
2018-02-01 02:16:57 +00:00
|
|
|
|
and a ; TRADE_GENDER_EITHER
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ret z
|
2018-02-01 02:16:57 +00:00
|
|
|
|
cp TRADE_GENDER_MALE
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld a, "♂"
|
|
|
|
|
jr z, .done
|
2018-02-01 02:16:57 +00:00
|
|
|
|
; TRADE_GENDER_FEMALE
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld a, "♀"
|
|
|
|
|
.done
|
|
|
|
|
ld [hli], a
|
|
|
|
|
ld [hl], "@"
|
|
|
|
|
ret
|
|
|
|
|
|
2018-01-26 03:19:24 +00:00
|
|
|
|
INCLUDE "data/events/npc_trades.asm"
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
PrintTradeText:
|
2015-11-19 23:07:20 +00:00
|
|
|
|
push af
|
|
|
|
|
call GetTradeMonNames
|
|
|
|
|
pop af
|
|
|
|
|
ld bc, 2 * 4
|
|
|
|
|
ld hl, TradeTexts
|
|
|
|
|
call AddNTimes
|
|
|
|
|
ld a, [wcf64]
|
|
|
|
|
ld c, a
|
|
|
|
|
add hl, bc
|
2016-05-04 15:46:23 +00:00
|
|
|
|
add hl, bc
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld a, [hli]
|
|
|
|
|
ld h, [hl]
|
|
|
|
|
ld l, a
|
|
|
|
|
call PrintText
|
|
|
|
|
ret
|
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
|
TradeTexts:
|
2018-02-01 02:16:57 +00:00
|
|
|
|
; entries correspond to TRADE_DIALOG_* × TRADE_DIALOGSET_* constants
|
|
|
|
|
; TRADE_DIALOG_INTRO
|
2019-10-20 22:24:17 +00:00
|
|
|
|
dw NPCTradeIntroText1
|
|
|
|
|
dw NPCTradeIntroText2
|
|
|
|
|
dw NPCTradeIntroText2
|
|
|
|
|
dw NPCTradeIntroText3
|
2018-02-01 02:16:57 +00:00
|
|
|
|
; TRADE_DIALOG_CANCEL
|
2019-10-20 22:24:17 +00:00
|
|
|
|
dw NPCTradeCancelText1
|
|
|
|
|
dw NPCTradeCancelText2
|
|
|
|
|
dw NPCTradeCancelText2
|
|
|
|
|
dw NPCTradeCancelText3
|
2018-02-01 02:16:57 +00:00
|
|
|
|
; TRADE_DIALOG_WRONG
|
2019-10-20 22:24:17 +00:00
|
|
|
|
dw NPCTradeWrongText1
|
|
|
|
|
dw NPCTradeWrongText2
|
|
|
|
|
dw NPCTradeWrongText2
|
|
|
|
|
dw NPCTradeWrongText3
|
2018-02-01 02:16:57 +00:00
|
|
|
|
; TRADE_DIALOG_COMPLETE
|
2019-10-20 22:24:17 +00:00
|
|
|
|
dw NPCTradeCompleteText1
|
|
|
|
|
dw NPCTradeCompleteText2
|
|
|
|
|
dw NPCTradeCompleteText4
|
|
|
|
|
dw NPCTradeCompleteText3
|
2018-02-01 02:16:57 +00:00
|
|
|
|
; TRADE_DIALOG_AFTER
|
2019-10-20 22:24:17 +00:00
|
|
|
|
dw NPCTradeAfterText1
|
|
|
|
|
dw NPCTradeAfterText2
|
|
|
|
|
dw NPCTradeAfterText4
|
|
|
|
|
dw NPCTradeAfterText3
|
|
|
|
|
|
|
|
|
|
NPCTradeCableText:
|
|
|
|
|
text_far _NPCTradeCableText
|
2018-11-17 18:33:03 +00:00
|
|
|
|
text_end
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
|
TradedForText:
|
2015-11-19 23:07:20 +00:00
|
|
|
|
; traded givemon for getmon
|
2019-10-20 22:24:17 +00:00
|
|
|
|
text_far Text_NPCTraded
|
2018-11-17 18:33:03 +00:00
|
|
|
|
text_asm
|
2015-11-19 23:07:20 +00:00
|
|
|
|
ld de, MUSIC_NONE
|
|
|
|
|
call PlayMusic
|
|
|
|
|
call DelayFrame
|
|
|
|
|
ld hl, .done
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
.done
|
2019-10-20 22:24:17 +00:00
|
|
|
|
text_far _NPCTradeFanfareText
|
2018-11-17 18:33:03 +00:00
|
|
|
|
text_end
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
|
NPCTradeIntroText1:
|
2019-03-11 00:43:34 +00:00
|
|
|
|
text_far _NPCTradeIntroText1
|
2018-11-17 18:33:03 +00:00
|
|
|
|
text_end
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
|
NPCTradeCancelText1:
|
2019-03-11 00:43:34 +00:00
|
|
|
|
text_far _NPCTradeCancelText1
|
2018-11-17 18:33:03 +00:00
|
|
|
|
text_end
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
|
NPCTradeWrongText1:
|
2019-03-11 00:43:34 +00:00
|
|
|
|
text_far _NPCTradeWrongText1
|
2018-11-17 18:33:03 +00:00
|
|
|
|
text_end
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
|
NPCTradeCompleteText1:
|
2019-03-11 00:43:34 +00:00
|
|
|
|
text_far _NPCTradeCompleteText1
|
2018-11-17 18:33:03 +00:00
|
|
|
|
text_end
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
|
NPCTradeAfterText1:
|
|
|
|
|
text_far _NPCTradeAfterText1
|
2018-11-17 18:33:03 +00:00
|
|
|
|
text_end
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
|
NPCTradeIntroText2:
|
2019-03-11 00:43:34 +00:00
|
|
|
|
text_far _NPCTradeIntroText2
|
2018-11-17 18:33:03 +00:00
|
|
|
|
text_end
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
|
NPCTradeCancelText2:
|
2019-03-11 00:43:34 +00:00
|
|
|
|
text_far _NPCTradeCancelText2
|
2018-11-17 18:33:03 +00:00
|
|
|
|
text_end
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
|
NPCTradeWrongText2:
|
2019-03-11 00:43:34 +00:00
|
|
|
|
text_far _NPCTradeWrongText2
|
2018-11-17 18:33:03 +00:00
|
|
|
|
text_end
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
|
NPCTradeCompleteText2:
|
2019-03-11 00:43:34 +00:00
|
|
|
|
text_far _NPCTradeCompleteText2
|
2018-11-17 18:33:03 +00:00
|
|
|
|
text_end
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
|
NPCTradeAfterText2:
|
2019-03-11 00:43:34 +00:00
|
|
|
|
text_far _NPCTradeAfterText2
|
2018-11-17 18:33:03 +00:00
|
|
|
|
text_end
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
|
NPCTradeIntroText3:
|
2019-03-11 00:43:34 +00:00
|
|
|
|
text_far _NPCTradeIntroText3
|
2018-11-17 18:33:03 +00:00
|
|
|
|
text_end
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
|
NPCTradeCancelText3:
|
2019-03-11 00:43:34 +00:00
|
|
|
|
text_far _NPCTradeCancelText3
|
2018-11-17 18:33:03 +00:00
|
|
|
|
text_end
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
|
NPCTradeWrongText3:
|
2019-03-11 00:43:34 +00:00
|
|
|
|
text_far _NPCTradeWrongText3
|
2018-11-17 18:33:03 +00:00
|
|
|
|
text_end
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
|
NPCTradeCompleteText3:
|
2019-03-11 00:43:34 +00:00
|
|
|
|
text_far _NPCTradeCompleteText3
|
2018-11-17 18:33:03 +00:00
|
|
|
|
text_end
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
|
NPCTradeAfterText3:
|
2019-03-11 00:43:34 +00:00
|
|
|
|
text_far _NPCTradeAfterText3
|
2018-11-17 18:33:03 +00:00
|
|
|
|
text_end
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
|
NPCTradeCompleteText4:
|
2019-03-11 00:43:34 +00:00
|
|
|
|
text_far _NPCTradeCompleteText4
|
2018-11-17 18:33:03 +00:00
|
|
|
|
text_end
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
2019-10-20 22:24:17 +00:00
|
|
|
|
NPCTradeAfterText4:
|
2019-03-11 00:43:34 +00:00
|
|
|
|
text_far _NPCTradeAfterText4
|
2018-11-17 18:33:03 +00:00
|
|
|
|
text_end
|