Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate the "Retrieve Deposit Box" mission to JSON format #62589

Merged
merged 11 commits into from
Jan 9, 2023
18 changes: 18 additions & 0 deletions data/json/effect_on_condition.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,24 @@
{ "u_lose_trait": "PROF_ASSASSIN_CONVICT" }
]
},
{
"type": "effect_on_condition",
"id": "get_katana",
"global": true,
"effect": { "u_spawn_item": "katana" }
},
{
"type": "effect_on_condition",
"id": "get_deagle_44",
"global": true,
"effect": { "u_spawn_item": "deagle_44" }
},
{
"type": "effect_on_condition",
"id": "get_m4_carbine",
"global": true,
"effect": { "u_spawn_item": "m4_carbine" }
},
{
"type": "effect_on_condition",
"id": "thunder",
Expand Down
19 changes: 17 additions & 2 deletions data/json/npcs/missiondef.json
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,23 @@
"difficulty": 2,
"value": 30000,
"item": "safe_box",
"start": "place_deposit_box",
"end": "deposit_box",
"start": {
"update_mapgen": { "place_item": [ { "item": "safe_box", "x": [ 18, 21 ], "y": [ 4, 6 ], "amount": 1 } ] },
"effect": "follow_only",
"assign_mission_target": { "om_terrain": "bank", "om_terrain_match_type": "PREFIX", "search_range": 120, "random": true, "z": 0 }
},
"end": {
"effect": [
"stop_following",
{
"weighted_list_eocs": [
[ { "id": "get_katana" }, { "const": 5 } ],
[ { "id": "get_deagle_44" }, { "const": 10 } ],
[ { "id": "get_m4_carbine" }, { "const": 6 } ]
]
MNG-cataclysm marked this conversation as resolved.
Show resolved Hide resolved
}
]
},
"origins": [ "ORIGIN_SECONDARY" ],
"followup": "MISSION_GET_DEPUTY_BADGE",
"dialogue": {
Expand Down
1 change: 0 additions & 1 deletion src/mission.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ struct mission_end {
// Nothing special happens
static void standard( mission * ) {}
// random valuable reward
static void deposit_box( mission * );
};

struct mission_fail {
Expand Down
19 changes: 0 additions & 19 deletions src/mission_end.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,3 @@
#include "rng.h"
#include "translations.h"
#include "item.h"

void mission_end::deposit_box( mission *miss )
{
npc *p = g->find_npc( miss->get_npc_id() );
if( p == nullptr ) {
debugmsg( "could not find mission NPC %d", miss->get_npc_id().get_value() );
return;
}
// Npc leaves your party
p->set_attitude( NPCATT_NULL );
std::string itemName = "deagle_44";
if( one_in( 4 ) ) {
itemName = "katana";
} else if( one_in( 3 ) ) {
itemName = "m4_carbine";
}
get_player_character().i_add( item( itemName, calendar::turn_zero ) );
add_msg( m_good, _( "%s gave you an item from the deposit box." ), p->get_name() );
}
1 change: 0 additions & 1 deletion src/missiondef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ static const std::map<std::string, std::function<void( mission * )>> mission_fun
{ "create_hidden_lab_console", mission_start::create_hidden_lab_console },
{ "create_ice_lab_console", mission_start::create_ice_lab_console },
// Endings
{ "deposit_box", mission_end::deposit_box }
// Failures
}
};
Expand Down