Skip to content

Commit

Permalink
animals and vermin now give treasure and sellable pelts/hides
Browse files Browse the repository at this point in the history
  • Loading branch information
b5635 committed Nov 6, 2024
1 parent 123032f commit b9af60e
Show file tree
Hide file tree
Showing 11 changed files with 395 additions and 154 deletions.
4 changes: 4 additions & 0 deletions src/are/_base.are.json
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,10 @@
}
]
},
"TileBrdrDisabled": {
"type": "byte",
"value": 0
},
"Tileset": {
"type": "resref",
"value": "tts01"
Expand Down
7 changes: 7 additions & 0 deletions src/gic/_base.gic.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@
"type": "cexostring",
"value": "Chest - 1 (Low treasure script)"
}
},
{
"__struct_id": 9,
"Comment": {
"type": "cexostring",
"value": ""
}
}
]
},
Expand Down
233 changes: 230 additions & 3 deletions src/git/_base.git.json
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@
},
"Cost": {
"type": "dword",
"value": 891000
"value": 179982
},
"Cursed": {
"type": "byte",
Expand Down Expand Up @@ -13878,7 +13878,7 @@
},
"Cost": {
"type": "dword",
"value": 2
"value": 0
},
"Cursed": {
"type": "byte",
Expand Down Expand Up @@ -14350,6 +14350,233 @@
"type": "float",
"value": 0.0
}
},
{
"__struct_id": 9,
"AnimationState": {
"type": "byte",
"value": 0
},
"Appearance": {
"type": "dword",
"value": 15115
},
"AutoRemoveKey": {
"type": "byte",
"value": 0
},
"Bearing": {
"type": "float",
"value": 0.0
},
"BodyBag": {
"type": "byte",
"value": 0
},
"CloseLockDC": {
"type": "byte",
"value": 0
},
"Conversation": {
"type": "resref",
"value": ""
},
"CurrentHP": {
"type": "short",
"value": 10
},
"Description": {
"type": "cexolocstring",
"value": {
"0": ""
}
},
"DisarmDC": {
"type": "byte",
"value": 0
},
"Faction": {
"type": "dword",
"value": 1
},
"Fort": {
"type": "byte",
"value": 5
},
"Hardness": {
"type": "byte",
"value": 5
},
"HasInventory": {
"type": "byte",
"value": 1
},
"HP": {
"type": "short",
"value": 10
},
"Interruptable": {
"type": "byte",
"value": 1
},
"KeyName": {
"type": "cexostring",
"value": ""
},
"KeyRequired": {
"type": "byte",
"value": 0
},
"Lockable": {
"type": "byte",
"value": 1
},
"Locked": {
"type": "byte",
"value": 0
},
"LocName": {
"type": "cexolocstring",
"value": {
"0": "_animal_loot_container"
}
},
"OnClick": {
"type": "resref",
"value": ""
},
"OnClosed": {
"type": "resref",
"value": ""
},
"OnDamaged": {
"type": "resref",
"value": ""
},
"OnDeath": {
"type": "resref",
"value": ""
},
"OnDisarm": {
"type": "resref",
"value": ""
},
"OnHeartbeat": {
"type": "resref",
"value": ""
},
"OnInvDisturbed": {
"type": "resref",
"value": ""
},
"OnLock": {
"type": "resref",
"value": ""
},
"OnMeleeAttacked": {
"type": "resref",
"value": ""
},
"OnOpen": {
"type": "resref",
"value": ""
},
"OnSpellCastAt": {
"type": "resref",
"value": ""
},
"OnTrapTriggered": {
"type": "resref",
"value": ""
},
"OnUnlock": {
"type": "resref",
"value": ""
},
"OnUsed": {
"type": "resref",
"value": ""
},
"OnUserDefined": {
"type": "resref",
"value": ""
},
"OpenLockDC": {
"type": "byte",
"value": 0
},
"Plot": {
"type": "byte",
"value": 1
},
"PortraitId": {
"type": "word",
"value": 515
},
"Ref": {
"type": "byte",
"value": 0
},
"Static": {
"type": "byte",
"value": 0
},
"Tag": {
"type": "cexostring",
"value": "_animal_loot_container"
},
"TemplateResRef": {
"type": "resref",
"value": "tm_pl_lizdang"
},
"TrapDetectable": {
"type": "byte",
"value": 1
},
"TrapDetectDC": {
"type": "byte",
"value": 0
},
"TrapDisarmable": {
"type": "byte",
"value": 1
},
"TrapFlag": {
"type": "byte",
"value": 0
},
"TrapOneShot": {
"type": "byte",
"value": 1
},
"TrapType": {
"type": "byte",
"value": 0
},
"Type": {
"type": "byte",
"value": 0
},
"Useable": {
"type": "byte",
"value": 1
},
"Will": {
"type": "byte",
"value": 0
},
"X": {
"type": "float",
"value": 10.5116
},
"Y": {
"type": "float",
"value": 14.9576
},
"Z": {
"type": "float",
"value": 0.0
}
}
]
},
Expand Down Expand Up @@ -23054,7 +23281,7 @@
},
"Cost": {
"type": "dword",
"value": 114
"value": 0
},
"Cursed": {
"type": "byte",
Expand Down
28 changes: 14 additions & 14 deletions src/itp/itempalcus.itp.json
Original file line number Diff line number Diff line change
Expand Up @@ -7680,44 +7680,44 @@
"__struct_id": 0,
"NAME": {
"type": "cexostring",
"value": "Hide"
"value": "Carapace"
},
"RESREF": {
"type": "resref",
"value": "animal_hide"
"value": "loot_carapace"
}
},
{
"__struct_id": 0,
"NAME": {
"type": "cexostring",
"value": "Hide"
},
"RESREF": {
"type": "resref",
"value": "meat"
},
"STRREF": {
"type": "dword",
"value": 13378
"value": "loot_hide"
}
},
{
"__struct_id": 0,
"NAME": {
"type": "cexostring",
"value": "Pelt"
},
"RESREF": {
"type": "resref",
"value": "skin"
},
"STRREF": {
"type": "dword",
"value": 13379
"value": "loot_pelt"
}
},
{
"__struct_id": 0,
"NAME": {
"type": "cexostring",
"value": "Tooth"
"value": "Skin"
},
"RESREF": {
"type": "resref",
"value": "tooth"
"value": "loot_skin"
}
}
]
Expand Down
35 changes: 35 additions & 0 deletions src/nss/inc_loot.nss
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ const float PLACEABLE_DESTROY_LOOT_PENALTY = 0.6;
const float BOSS_CR_MULTIPLIER = 1.0;
const float SEMIBOSS_CR_MULTIPLIER = 1.0;

const int BOSS_GOLD_MULTIPLIER = 5;
const int SEMIBOSS_RARE_GOLD_MULTIPLIER = 3;

// Increased area CR means higher quality loot (and higher quality potential loot,
//eventually this should be re-named as the name is confusing
// This was replaced with the quality modifiers above which affect the loot weights directly
Expand Down Expand Up @@ -1287,6 +1290,38 @@ int DetermineGoldFromCR(int iCR, int nMultiplier=1)
return iResult;
}

object GenerateAnimalLoot(object oCreature, int nAnimalGoldMultiplier, object oContainer)
{
int nCreatureSize = GetCreatureSize(oCreature);
if (nCreatureSize < CREATURE_SIZE_MEDIUM) return OBJECT_INVALID;

string sResRef = "loot_skin";

int nRace = GetRacialType(oCreature);
switch (nRace)
{
case RACIAL_TYPE_MAGICAL_BEAST: sResRef = "loot_hide"; break;
case RACIAL_TYPE_ANIMAL: sResRef = "loot_pelt"; break;
case RACIAL_TYPE_BEAST: sResRef = "loot_pelt"; break;
case RACIAL_TYPE_VERMIN: sResRef = "loot_carapace"; break;
}

int nBaseGold = GetMaxHitPoints(oCreature) + (GetHitDice(oCreature) * 4) + (GetBaseAttackBonus(oCreature) * 3);

int nGold = nCreatureSize * (nAnimalGoldMultiplier * nBaseGold);

object oItem = CreateItemOnObject(sResRef, oContainer);

NWNX_Item_SetAddGoldPieceValue(oItem, nGold);

// medium: 5 lbs, large: 10 lbs, huge: 15 lbs
AddItemProperty(DURATION_TYPE_PERMANENT, ItemPropertyWeightIncrease(nCreatureSize - 3), oItem);

SetName(oItem, GetName(oItem) + " (" + GetName(oCreature) + ")");

return oItem;
}

int ShouldDebugLoot()
{
if (GetLocalInt(GetModule(), LOOT_DEBUG_ENABLED))
Expand Down
Loading

0 comments on commit b9af60e

Please sign in to comment.