mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-02-21 12:29:05 +00:00
Enabled trading between characters. Fixed add-player command when party is full.
This commit is contained in:
parent
73b98f5b89
commit
2cd9d70e9a
@ -2895,7 +2895,8 @@ end
|
||||
export def addPlayerToParty(playerFuncNum)#0
|
||||
word p
|
||||
if countList(global=>p_players) == MAX_PARTY
|
||||
displayStr("Party too large.")
|
||||
rawDisplayStr("Party too large.")
|
||||
beep
|
||||
return
|
||||
fin
|
||||
p = createAndAddUnique(MOD_GEN_PLAYERS, playerFuncNum, @global=>p_players)
|
||||
|
@ -230,10 +230,14 @@ def selectThing(moduleNum, nThings, nSkip, prompt)#1
|
||||
nFunc = -1
|
||||
textHome()
|
||||
fin
|
||||
elsif moduleNum == MOD_GEN_PLAYERS
|
||||
// Players are big, so need collect each time
|
||||
mmgr(HEAP_COLLECT, 0)
|
||||
fin
|
||||
next
|
||||
|
||||
mmgr(FREE_MEMORY, pModule)
|
||||
^$c050
|
||||
return nFunc
|
||||
end
|
||||
|
||||
@ -242,11 +246,7 @@ end
|
||||
def _addItem(player)#1
|
||||
word funcNum
|
||||
funcNum = selectThing(MOD_GEN_ITEMS, NUM_ITEMS, 2, "Add item #: ")
|
||||
if funcNum >= 0
|
||||
giveItemToPlayer(player, funcNum)
|
||||
rdkey()
|
||||
fin
|
||||
^$c050
|
||||
if funcNum >= 0; giveItemToPlayer(player, funcNum); fin
|
||||
return 0
|
||||
end
|
||||
|
||||
@ -255,11 +255,7 @@ end
|
||||
def _addPlayer()#1
|
||||
word funcNum
|
||||
funcNum = selectThing(MOD_GEN_PLAYERS, NUM_PLAYERS, 1, "Add player #: ")
|
||||
if funcNum >= 0
|
||||
addPlayerToParty(funcNum)
|
||||
rdkey()
|
||||
fin
|
||||
^$c050
|
||||
if funcNum >= 0; addPlayerToParty(funcNum); fin
|
||||
return 0
|
||||
end
|
||||
|
||||
|
@ -411,9 +411,55 @@ def doEquip(player, item)#0
|
||||
calcPlayerArmor(player)
|
||||
end
|
||||
|
||||
def choosePlayer(disp, chooseNum, avoid)
|
||||
word player
|
||||
byte num
|
||||
player = global=>p_players
|
||||
num = 0
|
||||
while player
|
||||
if player <> avoid
|
||||
if num; rawDisplayStr(", "); fin
|
||||
if disp
|
||||
rawDisplayf2("%c) %s", num+'A', player=>s_name)
|
||||
elsif num == chooseNum
|
||||
return player
|
||||
fin
|
||||
num++
|
||||
fin
|
||||
player = player=>p_nextObj
|
||||
loop
|
||||
return num
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
def displayDone()#1
|
||||
clearMenuRect()
|
||||
clearMainRect()
|
||||
rawDisplayStr("Done.")
|
||||
pause(800)
|
||||
return NULL
|
||||
end
|
||||
|
||||
// Trade an item to another player/npc
|
||||
def doTrade(player, item)#1
|
||||
fatal("not yet: trade")
|
||||
word destPlayer
|
||||
byte nChoices, sel
|
||||
|
||||
clearMenuRect()
|
||||
rawDisplayStr("To: ")
|
||||
nChoices = choosePlayer(TRUE, 0, player)
|
||||
rawDisplayStr(" or [Esc]")
|
||||
while TRUE
|
||||
sel = getUpperKey()
|
||||
if sel == $1B; return 0; fin
|
||||
if sel >= 'A' and (sel-'A') < nChoices
|
||||
destPlayer = choosePlayer(FALSE, sel-'A', player)
|
||||
removeFromList(@player=>p_items, item)
|
||||
addUnique(@destPlayer=>p_items, item)
|
||||
return displayDone
|
||||
fin
|
||||
beep
|
||||
loop
|
||||
return 0
|
||||
end
|
||||
|
||||
@ -500,15 +546,6 @@ def displayItems(pItem1, pItem2)#0
|
||||
_displayItemStats(pItem1, pItem2)
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
def displayDone()#1
|
||||
clearMenuRect()
|
||||
clearMainRect()
|
||||
rawDisplayStr("Done.")
|
||||
pause(800)
|
||||
return NULL
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
def interactWithItem(player, item)#1
|
||||
word comp, quantity
|
||||
@ -628,7 +665,7 @@ def _showPlayerSheet(player_num)#1 // funcTbl functions always have to return a
|
||||
when sel
|
||||
is '1'; is '2'; is '3'
|
||||
sel = sel - '1'
|
||||
if player_num <> sel and countList(global=>p_players) > sel
|
||||
if countList(global=>p_players) > sel
|
||||
player_num = sel
|
||||
i_page = 0
|
||||
redisplay = 2
|
||||
@ -672,12 +709,14 @@ def _showPlayerSheet(player_num)#1 // funcTbl functions always have to return a
|
||||
break
|
||||
is '%' // add item cheat
|
||||
if global->b_godmode
|
||||
clearMainRect()
|
||||
pGodModule=>godmode_addItem(player)
|
||||
redisplay = 2
|
||||
fin
|
||||
break
|
||||
is '9' // add player cheat
|
||||
if global->b_godmode
|
||||
clearMainRect()
|
||||
pGodModule=>godmode_addPlayer()
|
||||
redisplay = 2
|
||||
fin
|
||||
|
Loading…
x
Reference in New Issue
Block a user