Skip to content

Commit

Permalink
Give the player some crates if they don't have any
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonmoonen committed May 15, 2024
1 parent 4781172 commit 2a9d941
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/servers/ZoneServer2016/data/loadouts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,9 @@ export const lootableContainerDefaultLoadouts = {
repair_box: [{ item: Items.CONTAINER_REPAIR_BOX }],
stash: [{ item: Items.CONTAINER_STASH }]
};

export const accountInventoryDefaultRewards = [
{ item: Items.REWARD_CRATE_WEARABLES, count: 3 },
{ item: Items.REWARD_CRATE_ALPHA_LAUNCH, count: 3 },
{ item: Items.MYSTERY_BAG_1, count: 2 }
];
47 changes: 46 additions & 1 deletion src/servers/ZoneServer2016/models/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,52 @@ export enum Items {
SKIN_PINK_FACE_BANDANA = 2304,
SKIN_PINK_BIKER_SHADES = 2295,
SKIN_SKULL_FACE_BANDANA = 2306,
SKIN_BLACK_BIKER_SHADES = 2292
SKIN_BLACK_BIKER_SHADES = 2292,
REWARD_CRATE_SHOWDOWN = 2761,
REWARD_CRATE_ALPHA_LAUNCH = 1797,
REWARD_CRATE_PREDATOR_GOLD = 3211,
REWARD_CRATE_PREDATOR_SILVER = 3210,
REWARD_CRATE_PREDATOR_BRONZE = 3209,
REWARD_CRATE_PREDATOR = 3207,
REWARD_CRATE_EZW_GOLD = 3122,
REWARD_CRATE_EZW_SILVER = 3121,
REWARD_CRATE_EZW_BRONZE = 3120,
REWARD_CRATE_EZW = 3118,
REWARD_CRATE_RENEGADE_GOLD = 2893,
REWARD_CRATE_RENEGADE_SILVER = 2892,
REWARD_CRATE_RENEGADE_BRONZE = 2891,
REWARD_CRATE_RENEGADE = 2836,
REWARD_CRATE_WASTELAND_GOLD = 3028,
REWARD_CRATE_WASTELAND_SILVER = 3027,
REWARD_CRATE_WASTELAND_BRONZE = 3026,
REWARD_CRATE_WASTELAND = 2939,
REWARD_CRATE_BR_1 = 2031,
REWARD_CRATE_BR_2 = 2350,
REWARD_CRATE_INVITATIONAL = 2436,
REWARD_CRATE_WEARABLES = 2009,
REWARD_CRATE_MARAUDER = 2276,
REWARD_CRATE_MERCENARY = 2432,
REWARD_CRATE_RONIN = 3501,
REWARD_CRATE_INVITATIONAL_2016_GOLD = 3573,
REWARD_CRATE_INVITATIONAL_2016_SILVER = 3572,
REWARD_CRATE_INVITATIONAL_2016_BRONZE = 3571,
REWARD_CRATE_INVITATIONAL_2016 = 3569,
REWARD_CRATE_INFERNAL_GOLD = 3824,
REWARD_CRATE_INFERNAL_SILVER = 3823,
REWARD_CRATE_INFERNAL_BRONZE = 3822,
REWARD_CRATE_INFERNAL = 3821,
MYSTERY_BAG_KOTK = 3239,
KOTK_ELITE_BAG = 3240,
SKIRMISH_SMALL_FIREARMS = 3274,
SKIRMISH_SHOTTIES_SNIPERS = 3365,
SKIRMISH_IRONMAN = 3447,
SKIRMISH_REANIMATED = 3523,
SKIRMISH_SHOTTIES_SNIPERS_2 = 3633,
MYSTERY_BAG_1 = 1840,
ELITE_BAG = 1841,
MYSTERY_BAG_2 = 1879,
ELITE_BAG_HARDCORE = 1880,
MYSTERY_BAG_V2 = 2033
}

export enum WeaponDefinitionIds {
Expand Down
10 changes: 10 additions & 0 deletions src/servers/ZoneServer2016/zoneserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ import { WaterSource } from "./entities/watersource";
import { WebSocket } from "ws";
import { CommandHandler } from "./handlers/commands/commandhandler";
import { AccountInventory } from "./classes/accountinventory";
import { accountInventoryDefaultRewards } from "./data/loadouts";

const spawnLocations2 = require("../../../data/2016/zoneData/Z1_gridSpawns.json"),
deprecatedDoors = require("../../../data/2016/sampleData/deprecatedDoors.json"),
Expand Down Expand Up @@ -1289,6 +1290,15 @@ export class ZoneServer2016 extends EventEmitter {
if (this._accountInventories[accountInventory.loginSessionId]) {
delete this._accountInventories[accountInventory.loginSessionId];
}

// Give a new player some gifts
if (Object.values(accountInventory.items).length == 0) {
Object.values(accountInventoryDefaultRewards).forEach((gift) => {
const item = this.generateItem(gift.item, gift.count);
if (!item) return;
accountInventory.items[item.itemGuid] = item;
});
}
this._accountInventories[accountInventory.loginSessionId] =
accountInventory;
}
Expand Down

0 comments on commit 2a9d941

Please sign in to comment.