Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6ce071d

Browse files
authoredMar 19, 2025··
fix(content): more partyroom changes (#1506)
* fix: reorganize partyroominv as objs are depleted * fix: more partyroom changes
1 parent c744bee commit 6ce071d

File tree

4 files changed

+85
-51
lines changed

4 files changed

+85
-51
lines changed
 

‎data/src/scripts/general/scripts/invs.rs2

+40
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,46 @@ while ($i < enum_getoutputcount($slots)) {
2424
}
2525
return(true);
2626

27+
// reorganize all of the slots towards the left of the inv.
28+
[proc,reorganize_inv](inv $inv)
29+
def_int $size = inv_size($inv);
30+
def_int $count = 0;
31+
32+
while ($count < $size) {
33+
def_int $slot_count = inv_getnum($inv, $count);
34+
35+
if ($slot_count = 0) {
36+
def_int $peek_slot = ~inv_peek_next_available_obj_slot($inv, $count);
37+
38+
if ($peek_slot = -1) {
39+
$count = add($size, 1);
40+
} else {
41+
inv_movetoslot($inv, $inv, $peek_slot, $count);
42+
$count = add($count, 1);
43+
}
44+
} else {
45+
$count = add($count, 1);
46+
}
47+
}
48+
49+
// used to check for any obj slots that are ahead of the input slot.
50+
// returns the slot or -1 if none available.
51+
[proc,inv_peek_next_available_obj_slot](inv $inv, int $from_slot)(int)
52+
def_int $size = inv_size($inv);
53+
def_int $count = $from_slot;
54+
def_int $slot = -1;
55+
56+
while ($count < $size) {
57+
def_int $slot_count = inv_getnum($inv, $count);
58+
if ($slot_count = 0) {
59+
$count = add($count, 1);
60+
} else {
61+
$slot = $count;
62+
$count = add($size, 1);
63+
}
64+
}
65+
return($slot);
66+
2767
[proc,del_all_if_exists](inv $inv, namedobj $obj)
2868
def_int $total = inv_total($inv, $obj);
2969
if ($total > 0) {

‎data/src/scripts/interface_bank/scripts/bank.rs2

+6-45
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
[label,openbank]
1212
%bank_noted = 0;
13-
~reorganize_bank;
13+
~reorganize_inv(bank);
1414
inv_transmit(inv, bank_side:inv);
1515
inv_transmit(bank, bank_main:inv);
1616
if_openmain_side(bank_main, bank_side);
@@ -20,8 +20,12 @@ inv_stoptransmit(bank_side:inv);
2020
inv_stoptransmit(bank_main:inv);
2121
queue(reorganize_bank, 0); // confirmed queued
2222

23+
// reorganize the bank like when you open the bank.
24+
// this is because a player can move objs around in the bank
25+
// to any slot that is available. so when they open the bank
26+
// we reorganize all of the slots towards the left of the bank.
2327
[queue,reorganize_bank]
24-
~reorganize_bank;
28+
~reorganize_inv(bank);
2529

2630
[label,bank_withdraw](int $slot, int $requested_number)
2731
// Check if the slot was empty.
@@ -107,49 +111,6 @@ if (map_members = false) {
107111
}
108112
return(false);
109113

110-
// reorganize the bank like when you open the bank.
111-
// this is because a player can move objs around in the bank
112-
// to any slot that is available. so when they open the bank
113-
// we reorganize all of the slots towards the left of the bank.
114-
[proc,reorganize_bank]
115-
def_int $size = inv_size(bank);
116-
def_int $count = 0;
117-
118-
while ($count < $size) {
119-
def_int $slot_count = inv_getnum(bank, $count);
120-
121-
if ($slot_count = 0) {
122-
def_int $peek_slot = ~bank_peek_next_available_obj_slot($count);
123-
124-
if ($peek_slot = -1) {
125-
$count = add($size, 1);
126-
} else {
127-
inv_movetoslot(bank, bank, $peek_slot, $count);
128-
$count = add($count, 1);
129-
}
130-
} else {
131-
$count = add($count, 1);
132-
}
133-
}
134-
135-
// used to check for any obj slots that are ahead of the input slot.
136-
// returns the slot or -1 if none available.
137-
[proc,bank_peek_next_available_obj_slot](int $from_slot)(int)
138-
def_int $size = inv_size(bank);
139-
def_int $count = $from_slot;
140-
def_int $slot = -1;
141-
142-
while ($count < $size) {
143-
def_int $slot_count = inv_getnum(bank, $count);
144-
if ($slot_count = 0) {
145-
$count = add($count, 1);
146-
} else {
147-
$slot = $count;
148-
$count = add($size, 1);
149-
}
150-
}
151-
return($slot);
152-
153114
// returns if an obj is considered to be unbankable.
154115
// experience lamps, quest items, etc.
155116
[proc,bank_find_obj_unbankable](obj $obj)(boolean)

‎data/src/scripts/minigames/game_partyroom/scripts/partyroom.rs2

+22-3
Original file line numberDiff line numberDiff line change
@@ -138,17 +138,36 @@ p_delay(0);
138138
loc_change($broken_balloon, 6);
139139
// todo: chance was fixed before Jul 2004, was changed to scale off of chest freespace afterwards (this chance is just a guess unfortunately)
140140
if (~inzone_coord_pair_table(party_room_zones, loc_coord) = true & random(4) = 0) {
141-
def_int $rand_slot = random(calc(inv_size(partyroominv) - inv_freespace(partyroominv)));
141+
def_int $partyroom_size = inv_size(partyroominv);
142+
def_int $free_slots = calc($partyroom_size - inv_freespace(partyroominv));
143+
def_int $rand_slot = random(calc($free_slots + ~partyroom_empty_slots($free_slots)));
142144
def_obj $obj = inv_getobj(partyroominv, $rand_slot);
143145
def_int $count = 1;
146+
def_int $obj_total = inv_getnum(partyroominv, $rand_slot);
144147
if($obj = null) {
145148
return;
146149
}
147150
if(oc_stackable($obj) = true | oc_uncert($obj) ! $obj) {
148-
$count = ~random_range(1, inv_getnum(partyroominv, $rand_slot));
151+
$count = ~random_range(1, $obj_total);
149152
}
150153
inv_dropitem(partyroominv, loc_coord, $obj, $count, 100);
154+
// for w/e reason, in old videos the inv doesn't reorg sometimes, there doesn't seem to be any specific condition for it
155+
// https://youtu.be/Ve5UF8B3BMw?si=NKO9H7bd6rJGY_LF&t=251
156+
if($count = $obj_total & random(3) < 2) {
157+
~reorganize_inv(partyroominv);
158+
}
151159
return;
152160
}
153161
p_delay(0);
154-
loc_del(1);
162+
loc_del(1);
163+
164+
[proc,partyroom_empty_slots](int $free_slots)(int)
165+
def_int $slot = 0;
166+
def_int $count = 0;
167+
while($slot < $free_slots) {
168+
if(inv_getobj(partyroominv, $slot) = null) {
169+
$count = add($count,1);
170+
}
171+
$slot = add($slot,1);
172+
}
173+
return ($count);

‎data/src/scripts/minigames/game_partyroom/scripts/partyroom_chest.rs2

+17-3
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,22 @@ if($total = 0 | inv_itemspace(partyroomoffer, $obj, $total, inv_size(partyroomof
6262
inv_moveitem(inv, partyroomoffer, $obj, $total);
6363

6464
[if_button,party_drop_chest:com_94]
65-
if(inv_freespace(partyroominv) < calc(inv_size(partyroomoffer) - inv_freespace(partyroomoffer))) {
66-
mes("The chest cannot hold your offer at the moment.");
65+
def_int $i = 0;
66+
def_boolean $moveditem = false;
67+
if(inv_freespace(partyroomoffer) = inv_size(partyroomoffer)) {
6768
return;
6869
}
69-
~moveallinv(partyroomoffer, partyroominv);
70+
while($i < inv_size(partyroomoffer)) {
71+
def_obj $obj = inv_getobj(partyroomoffer, $i);
72+
def_int $count = inv_getnum(partyroomoffer, $i);
73+
if ($obj ! null) {
74+
if(inv_itemspace(partyroominv, $obj, $count, inv_size(partyroominv)) = true) {
75+
inv_moveitem(partyroomoffer, partyroominv, $obj, $count);
76+
$moveditem = true;
77+
}
78+
}
79+
$i = add($i, 1);
80+
}
81+
if($moveditem = false) {
82+
mes("The chest cannot hold your offer at the moment.");
83+
}

0 commit comments

Comments
 (0)
Please sign in to comment.