mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-07 02:03:51 +00:00
[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:
parent
25705878d8
commit
0f9427098d
@ -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_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, ForageChance, 25, "Chance of foraging from zone table vs global table")
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Map)
|
||||
|
||||
@ -419,7 +419,6 @@ void Client::GoFish()
|
||||
}
|
||||
|
||||
void Client::ForageItem(bool guarantee) {
|
||||
|
||||
int skill_level = GetSkill(EQ::skills::SkillForage);
|
||||
|
||||
//be wary of the string ids in switch below when changing this.
|
||||
@ -439,12 +438,12 @@ void Client::ForageItem(bool guarantee) {
|
||||
uint32 foragedfood = 0;
|
||||
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);
|
||||
}
|
||||
|
||||
//not an else in case theres no DB food
|
||||
if(foragedfood == 0) {
|
||||
if (foragedfood == 0) {
|
||||
uint8 index = 0;
|
||||
index = zone->random.Int(0, MAX_COMMON_FOOD_IDS-1);
|
||||
foragedfood = common_food_ids[index];
|
||||
@ -452,48 +451,49 @@ void Client::ForageItem(bool guarantee) {
|
||||
|
||||
const EQ::ItemData* food_item = database.GetItem(foragedfood);
|
||||
|
||||
if(!food_item) {
|
||||
if (!food_item) {
|
||||
LogError("nullptr returned from database.GetItem in ClientForageItem");
|
||||
return;
|
||||
}
|
||||
|
||||
if(foragedfood == 13106)
|
||||
if (foragedfood == 13106) {
|
||||
stringid = FORAGE_GRUBS;
|
||||
else
|
||||
} else {
|
||||
switch(food_item->ItemType) {
|
||||
case EQ::item::ItemTypeFood:
|
||||
stringid = FORAGE_FOOD;
|
||||
break;
|
||||
case EQ::item::ItemTypeDrink:
|
||||
if(strstr(food_item->Name, "ater"))
|
||||
if (strstr(food_item->Name, "ater")) {
|
||||
stringid = FORAGE_WATER;
|
||||
else
|
||||
} else {
|
||||
stringid = FORAGE_DRINK;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
MessageString(Chat::Skills, stringid);
|
||||
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
|
||||
if(CheckLoreConflict(inst->GetItem()))
|
||||
{
|
||||
if (CheckLoreConflict(inst->GetItem())) {
|
||||
MessageString(Chat::White, DUP_LORE);
|
||||
safe_delete(inst);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
PushItemOnCursor(*inst);
|
||||
SendItemPacket(EQ::invslot::slotCursor, inst, ItemPacketLimbo);
|
||||
if(RuleB(TaskSystem, EnableTaskSystem))
|
||||
if(RuleB(TaskSystem, EnableTaskSystem)) {
|
||||
UpdateTasksForItem(TaskActivityType::Forage, foragedfood);
|
||||
}
|
||||
|
||||
safe_delete(inst);
|
||||
inst = m_inv.GetItem(EQ::invslot::slotCursor);
|
||||
}
|
||||
|
||||
if(inst) {
|
||||
if (inst) {
|
||||
std::vector<std::any> args;
|
||||
args.push_back(inst);
|
||||
parse->EventPlayer(EVENT_FORAGE_SUCCESS, this, "", inst->GetID(), &args);
|
||||
@ -501,17 +501,14 @@ void Client::ForageItem(bool guarantee) {
|
||||
}
|
||||
|
||||
int ChanceSecondForage = aabonuses.ForageAdditionalItems + itembonuses.ForageAdditionalItems + spellbonuses.ForageAdditionalItems;
|
||||
if(!guarantee && zone->random.Roll(ChanceSecondForage)) {
|
||||
if (!guarantee && zone->random.Roll(ChanceSecondForage)) {
|
||||
MessageString(Chat::Skills, FORAGE_MASTERY);
|
||||
ForageItem(true);
|
||||
}
|
||||
|
||||
} else {
|
||||
MessageString(Chat::Skills, FORAGE_FAILED);
|
||||
parse->EventPlayer(EVENT_FORAGE_FAILURE, this, "", 0);
|
||||
}
|
||||
|
||||
CheckIncreaseSkill(EQ::skills::SkillForage, nullptr, 5);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user