[Rules] Add adjustment for zone forage. (#2330)

* [Rules] Add adjustment for zone forage.

- Added rule to allow the adjustment of zone foraging %

* Cleanup if formating
This commit is contained in:
Michael 2022-07-30 14:39:12 -04:00 committed by GitHub
parent 25705878d8
commit 0f9427098d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 19 deletions

View File

@ -302,6 +302,7 @@ RULE_INT(Zone, GlobalLootMultiplier, 1, "Sets Global Loot drop multiplier for da
RULE_BOOL(Zone, KillProcessOnDynamicShutdown, true, "When process has booted a zone and has hit its zone shut down timer, it will hard kill the process to free memory back to the OS") RULE_BOOL(Zone, KillProcessOnDynamicShutdown, true, "When process has booted a zone and has hit its zone shut down timer, it will hard kill the process to free memory back to the OS")
RULE_INT(Zone, SecondsBeforeIdle, 60, "Seconds before IDLE_WHEN_EMPTY define kicks in") RULE_INT(Zone, SecondsBeforeIdle, 60, "Seconds before IDLE_WHEN_EMPTY define kicks in")
RULE_INT(Zone, SpawnEventMin, 3, "When strict is set in spawn_events, specifies the max EQ minutes into the trigger hour a spawn_event will fire. Going below 3 may cause the spawn_event to not fire.") RULE_INT(Zone, SpawnEventMin, 3, "When strict is set in spawn_events, specifies the max EQ minutes into the trigger hour a spawn_event will fire. Going below 3 may cause the spawn_event to not fire.")
RULE_INT(Zone, ForageChance, 25, "Chance of foraging from zone table vs global table")
RULE_CATEGORY_END() RULE_CATEGORY_END()
RULE_CATEGORY(Map) RULE_CATEGORY(Map)

View File

@ -419,7 +419,6 @@ void Client::GoFish()
} }
void Client::ForageItem(bool guarantee) { void Client::ForageItem(bool guarantee) {
int skill_level = GetSkill(EQ::skills::SkillForage); int skill_level = GetSkill(EQ::skills::SkillForage);
//be wary of the string ids in switch below when changing this. //be wary of the string ids in switch below when changing this.
@ -439,7 +438,7 @@ void Client::ForageItem(bool guarantee) {
uint32 foragedfood = 0; uint32 foragedfood = 0;
uint32 stringid = FORAGE_NOEAT; uint32 stringid = FORAGE_NOEAT;
if (zone->random.Roll(25)) { if (zone->random.Roll(RuleI(Zone, ForageChance))) {
foragedfood = content_db.GetZoneForage(m_pp.zone_id, skill_level); foragedfood = content_db.GetZoneForage(m_pp.zone_id, skill_level);
} }
@ -457,37 +456,38 @@ void Client::ForageItem(bool guarantee) {
return; return;
} }
if(foragedfood == 13106) if (foragedfood == 13106) {
stringid = FORAGE_GRUBS; stringid = FORAGE_GRUBS;
else } else {
switch(food_item->ItemType) { switch(food_item->ItemType) {
case EQ::item::ItemTypeFood: case EQ::item::ItemTypeFood:
stringid = FORAGE_FOOD; stringid = FORAGE_FOOD;
break; break;
case EQ::item::ItemTypeDrink: case EQ::item::ItemTypeDrink:
if(strstr(food_item->Name, "ater")) if (strstr(food_item->Name, "ater")) {
stringid = FORAGE_WATER; stringid = FORAGE_WATER;
else } else {
stringid = FORAGE_DRINK; stringid = FORAGE_DRINK;
}
break; break;
default: default:
break; break;
} }
}
MessageString(Chat::Skills, stringid); MessageString(Chat::Skills, stringid);
EQ::ItemInstance* inst = database.CreateItem(food_item, 1); EQ::ItemInstance* inst = database.CreateItem(food_item, 1);
if (inst != nullptr) { if (inst != nullptr) {
// check to make sure it isn't a foraged lore item // check to make sure it isn't a foraged lore item
if(CheckLoreConflict(inst->GetItem())) if (CheckLoreConflict(inst->GetItem())) {
{
MessageString(Chat::White, DUP_LORE); MessageString(Chat::White, DUP_LORE);
safe_delete(inst); safe_delete(inst);
} } else {
else {
PushItemOnCursor(*inst); PushItemOnCursor(*inst);
SendItemPacket(EQ::invslot::slotCursor, inst, ItemPacketLimbo); SendItemPacket(EQ::invslot::slotCursor, inst, ItemPacketLimbo);
if(RuleB(TaskSystem, EnableTaskSystem)) if(RuleB(TaskSystem, EnableTaskSystem)) {
UpdateTasksForItem(TaskActivityType::Forage, foragedfood); UpdateTasksForItem(TaskActivityType::Forage, foragedfood);
}
safe_delete(inst); safe_delete(inst);
inst = m_inv.GetItem(EQ::invslot::slotCursor); inst = m_inv.GetItem(EQ::invslot::slotCursor);
@ -505,13 +505,10 @@ void Client::ForageItem(bool guarantee) {
MessageString(Chat::Skills, FORAGE_MASTERY); MessageString(Chat::Skills, FORAGE_MASTERY);
ForageItem(true); ForageItem(true);
} }
} else { } else {
MessageString(Chat::Skills, FORAGE_FAILED); MessageString(Chat::Skills, FORAGE_FAILED);
parse->EventPlayer(EVENT_FORAGE_FAILURE, this, "", 0); parse->EventPlayer(EVENT_FORAGE_FAILURE, this, "", 0);
} }
CheckIncreaseSkill(EQ::skills::SkillForage, nullptr, 5); CheckIncreaseSkill(EQ::skills::SkillForage, nullptr, 5);
} }