Skip to content

Commit

Permalink
fix: Misc fixes (2004Scape#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
Indio3 authored Dec 20, 2023
1 parent 5fc543c commit 8ff9e9f
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 28 deletions.
4 changes: 2 additions & 2 deletions data/pack/obj.pack
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,8 @@
574=cert_air_orb
575=earth_orb
576=cert_earth_orb
577=obj_577
578=cert_obj_577
577=wizards_robe
578=cert_wizards_robe
579=wizards_hat_blue
580=cert_wizards_hat_blue
581=obj_581
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ mes("*slooop*");
p_delay(1);
mes("He pulls a sea slug from under your top.");
p_delay(1);
obj_add(coord, sea_slug, 1, 20);
obj_add(coord, sea_slug, 1, ^lootdrop_duration);
~chatnpc(neutral, "A few more minutes and that thing would have full control of your body.");
~chatplayer(shock, "Yuck! Thanks Kent.");
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def_coord $dest = $loc_coord;
sound_synth(door_open, 0, 0); // iron_gate_open in OSRS
if ($entering = true) {
if (coord ! $loc_coord) {
p_walk($loc_coord);
p_teleport($loc_coord);
p_delay(1);
}
$dest = movecoord(loc_coord, $x, 0, $z);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ if(loc_coord = $end_pipe_coord) {
$end_pipe_coord = 0_40_148_16_34;
$start = 0_40_148_12_34;
}
def_int $delay_time = distance(coord, $start);
p_walk($start);
p_delay($delay_time);
~forcewalk($start);
if(%yanille_obstacle_pipe_used >= map_clock) {
mes("The pipe is being used"); // TODO: confirm, using the same as gnome course
return;
Expand Down
2 changes: 1 addition & 1 deletion data/src/scripts/drop tables/scripts/wizard.rs2
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def_int $random = random(128);
if ($random < 8) {
obj_add(npc_coord, plainstaff, 1, ^lootdrop_duration);
} else if ($random < 15) {
obj_add(npc_coord, obj_577, 1, ^lootdrop_duration);
obj_add(npc_coord, wizards_robe, 1, ^lootdrop_duration);
} else if ($random < 18) {
obj_add(npc_coord, wizards_hat_blue, 1, ^lootdrop_duration);
} else if ($random < 26) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ sound_synth(door_open, 0, 0);
mes("You've found a secret door!");
if ($entering = true) {
if (coord ! $loc_coord) {
p_walk($loc_coord);
p_teleport($loc_coord);
p_delay(1);
}
$dest = movecoord(loc_coord, $x, 0, $z);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
[opnpc1,sea_slug]
[opnpc1,sea_slug] @pickup_seaslug;
[opobj3,sea_slug] @pickup_seaslug;

[label,pickup_seaslug]
mes("You pick up the sea slug.");
mes("It sinks its teeth deep into your hand.");
mes("You drop the sea slug.");
Expand Down
2 changes: 2 additions & 0 deletions data/src/scripts/quests/quest_totem/scripts/quest_totem.rs2
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ if(%handelmort_traps_disabled = 0) {
// OSRS seems to only allow interaction from the top side of the ladder, so just going to assume
// this is probably how it worked in 2004
def_coord $start = movecoord(loc_coord, 0, 0, 3);
p_delay(0);
p_walk($start);
p_delay(calc(distance(coord, $start) + 1));
if(%handelmort_traps_disabled >= 2) {
Expand All @@ -125,6 +126,7 @@ p_delay(2);

[oploc2,loc_2711]
def_coord $start = movecoord(loc_coord, 0, 0, 3);
p_delay(0);
p_walk($start);
p_delay(calc(distance(coord, $start) + 1));
if(stat(thieving) < 21) {
Expand Down
6 changes: 3 additions & 3 deletions data/src/scripts/shop/scripts/shop.rs2
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ return (true);

// sell value
[inv_button1,shop_sell:inv]
def_obj $item = inv_getobj(inv, last_slot);
def_obj $item = oc_uncert(inv_getobj(inv, last_slot));
def_string $item_name = oc_name($item);
def_int $item_value = ~adjusted_item_cost_selling($item, inv_total(%shop, $item));
if(~can_sell_obj($item) = false) {
Expand Down Expand Up @@ -86,7 +86,7 @@ while($i < $amount) {

// Sell an item to the shop
[label,sell_item](obj $obj, int $amount)
def_int $shop_total = inv_total(%shop, $obj);
def_int $shop_total = inv_total(%shop, oc_uncert($obj));
def_int $total_value = 0;
def_int $sell_amount = ~calculate_items_amount_sold($obj, $amount);
if(~can_sell_obj($obj) = false) {
Expand All @@ -105,7 +105,7 @@ if(inv_itemspace(%shop, oc_uncert($obj), $sell_amount, inv_size(%shop)) = false)
// Iteration to calc the total value of the sale
def_int $i = 0;
while($i < $sell_amount) {
def_int $added_amt = ~adjusted_item_cost_selling($obj, calc($shop_total + $i));
def_int $added_amt = ~adjusted_item_cost_selling(oc_uncert($obj), calc($shop_total + $i));
$total_value = calc($total_value + $added_amt);
$i = calc($i + 1);
}
Expand Down
17 changes: 8 additions & 9 deletions data/src/scripts/skill_agility/scripts/agility.rs2
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ if ($change_z >= 1) {
}
// Perform movement and re-calc
def_coord $movement_coord = movecoord(coord, $move_x, 0, $move_z);
if(map_blocked($movement_coord) = true) {
p_teleport(movecoord(coord, $move_x, 0, $move_z));
} else { // walk when possible
p_walk(movecoord(coord, $move_x, 0, $move_z));
}
p_teleport(movecoord(coord, $move_x, 0, $move_z));
$change_x = calc($change_x - $move_x);
$change_z = calc($change_z - $move_z);
p_delay(0);
Expand Down Expand Up @@ -76,12 +72,15 @@ p_delay(0);
if(coord = $dest_coord) {
return;
}
def_int $original_run = %player_run;
def_int $delay = distance(coord, $dest_coord);
%player_run = 0;
def_int $dx = abs(calc(coordx(coord) - coordx($dest_coord)));
def_int $dz = abs(calc(coordz(coord) - coordz($dest_coord)));
def_int $delay = calc($dx + $dz - 1);
if(%player_run = 1) {
$delay = calc($delay / 2);
}
p_delay(0);
p_walk($dest_coord);
p_delay($delay);
%player_run = $original_run;

// Instant fail, not used as often
[proc,agility_instant_fail](coord $fail_coord, int $damage, string $message)
Expand Down
8 changes: 4 additions & 4 deletions data/src/scripts/skill_agility/scripts/shortcuts.rs2
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,13 @@ if(coordz(loc_coord) > coordz(loc_param(start_coord))) {
$start_coord = loc_param(end_coord);
$dist_mod = -1;
}
p_teleport($start_coord);
// osrs does this with running, video from july 2006 shows 1 tile walk at the start,
// teleport to the end of the spikes and walk 1 tile to the end of the bars
p_delay(1);
~forcewalk($start_coord);
facesquare(movecoord(coord, 0, 0, calc($dist_mod)));
anim(monkeybar_jump_up, 0);
~agility_force_move(0, monkeybar_move, movecoord(coord, 0, 0, calc($dist_mod * 1)));
p_delay(0);
~agility_force_move(0, monkeybar_move, movecoord(coord, 0, 0, calc($dist_mod * 2)));
// You can only fail the monkeybars in the agility dungeon
if(stat_random(stat(agility), loc_param(obstacle_low_fail), loc_param(obstacle_high_fail)) = false) {
def_coord $fall_pos = 0_40_149_39_19;
Expand All @@ -152,7 +152,7 @@ if(stat_random(stat(agility), loc_param(obstacle_low_fail), loc_param(obstacle_h
return;

}
p_teleport(movecoord(coord, 0, 0, calc($dist_mod * 3)));
p_telejump(movecoord(coord, 0, 0, calc($dist_mod * 2)));
p_delay(0);
~agility_force_move(200, monkeybar_move, movecoord(coord, 0, 0, calc($dist_mod * 1)));
anim(monkeybar_jump_down, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ if (stat(agility) < 49) {
return;
}
if(coord ! movecoord(loc_coord, 0, 0, -1)) {
p_walk(movecoord(loc_coord, 0, 0, -1));
p_delay(0);
p_walk(movecoord(loc_coord, 0, 0, -1));
}
// TODO: set var here and clear after the first exact move
if(%wilderness_obstacle_pipe_used >= map_clock) {
Expand Down
2 changes: 1 addition & 1 deletion data/src/scripts/skill_magic/configs/magic.obj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[obj_577]
[wizards_robe]
cost=15
name=Wizards robe
desc=I can do magic better in this.
Expand Down
1 change: 1 addition & 0 deletions src/lostcity/engine/script/handlers/PlayerOps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@ const PlayerOps: CommandHandlers = {
const startPos = Position.unpackCoord(start);
const endPos = Position.unpackCoord(end);

state.activePlayer.clearWalkingQueue();
state.activePlayer.exactMove(startPos.x, startPos.z, endPos.x, endPos.z, startCycle, endCycle, direction);
}),

Expand Down

0 comments on commit 8ff9e9f

Please sign in to comment.