From a5c32b63b7bfa648337b431a8e5c5ffe95d02eb7 Mon Sep 17 00:00:00 2001 From: Paul Coene Date: Fri, 2 Mar 2018 19:05:16 -0500 Subject: [PATCH 1/5] Make old style poison work much closer to live. --- zone/client_packet.cpp | 68 ++++++++++++++++++++++++++++-------------- 1 file changed, 46 insertions(+), 22 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index d336f7f0d..c647bde78 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -72,6 +72,9 @@ extern PetitionList petition_list; extern EntityList entity_list; typedef void (Client::*ClientPacketProc)(const EQApplicationPacket *app); +#define MIN(x,y) ((x) ConnectingOpcodes; //Use a static array for connected, for speed @@ -2861,41 +2864,57 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) DumpPacket(app); return; } + uint32 ApplyPoisonSuccessResult = 0; ApplyPoison_Struct* ApplyPoisonData = (ApplyPoison_Struct*)app->pBuffer; const EQEmu::ItemInstance* PrimaryWeapon = GetInv().GetItem(EQEmu::inventory::slotPrimary); const EQEmu::ItemInstance* SecondaryWeapon = GetInv().GetItem(EQEmu::inventory::slotSecondary); const EQEmu::ItemInstance* PoisonItemInstance = GetInv()[ApplyPoisonData->inventorySlot]; + const EQEmu::ItemData* poison=PoisonItemInstance->GetItem(); + const EQEmu::ItemData* primary=nullptr; + const EQEmu::ItemData* secondary=nullptr; + bool IsPoison = PoisonItemInstance && + (poison->ItemType == EQEmu::item::ItemTypePoison); - bool IsPoison = PoisonItemInstance && (PoisonItemInstance->GetItem()->ItemType == EQEmu::item::ItemTypePoison); - - if (!IsPoison) - { - Log(Logs::Detail, Logs::Spells, "Item used to cast spell effect from a poison item was missing from inventory slot %d " - "after casting, or is not a poison!", ApplyPoisonData->inventorySlot); - - Message(0, "Error: item not found for inventory slot #%i or is not a poison", ApplyPoisonData->inventorySlot); + if (PrimaryWeapon) { + primary=PrimaryWeapon->GetItem(); } - else if (GetClass() == ROGUE) - { - if ((PrimaryWeapon && PrimaryWeapon->GetItem()->ItemType == EQEmu::item::ItemType1HPiercing) || - (SecondaryWeapon && SecondaryWeapon->GetItem()->ItemType == EQEmu::item::ItemType1HPiercing)) { - float SuccessChance = (GetSkill(EQEmu::skills::SkillApplyPoison) + GetLevel()) / 400.0f; + + if (SecondaryWeapon) { + secondary=SecondaryWeapon->GetItem(); + } + + if (IsPoison && GetClass() == ROGUE) { + + // Live always checks for skillup, even when poison is too high + CheckIncreaseSkill(EQEmu::skills::SkillApplyPoison, nullptr, 10); + + if (poison->Proc.Level2 > GetLevel()) { + // Poison is too high to apply. + Message_StringID(clientMessageTradeskill, POISON_TOO_HIGH); + } + else if ((primary && + primary->ItemType == EQEmu::item::ItemType1HPiercing) || + (secondary && + secondary->ItemType == EQEmu::item::ItemType1HPiercing)) { + double ChanceRoll = zone->random.Real(0, 1); - CheckIncreaseSkill(EQEmu::skills::SkillApplyPoison, nullptr, 10); + // Poisons that use this skill (old world poisons) almost + // never fail to apply. I did 25 applies of a trivial 120+ + // poison with an apply skill of 48 and they all worked. + // Poisons that don't proc until a level higher than the + // rogue simply won't apply at all, as done above now. - if (ChanceRoll < SuccessChance) { + if (ChanceRoll < .90) { ApplyPoisonSuccessResult = 1; - // NOTE: Someone may want to tweak the chance to proc the poison effect that is added to the weapon here. - // My thinking was that DEX should be apart of the calculation. - AddProcToWeapon(PoisonItemInstance->GetItem()->Proc.Effect, false, (GetDEX() / 100) + 103); + AddProcToWeapon(poison->Proc.Effect, false, + (GetDEX() / 100) + 103); } - - DeleteItemInInventory(ApplyPoisonData->inventorySlot, 1, true); - - Log(Logs::General, Logs::None, "Chance to Apply Poison was %f. Roll was %f. Result is %u.", SuccessChance, ChanceRoll, ApplyPoisonSuccessResult); } + + // Live always deletes the item, success or failure. Even if too high. + DeleteItemInInventory(ApplyPoisonData->inventorySlot, 1, true); } auto outapp = new EQApplicationPacket(OP_ApplyPoison, nullptr, sizeof(ApplyPoison_Struct)); @@ -10790,6 +10809,11 @@ void Client::Handle_OP_PopupResponse(const EQApplicationPacket *app) case POPUPID_UPDATE_SHOWSTATSWINDOW: if (GetTarget() && GetTarget()->IsClient()) GetTarget()->CastToClient()->SendStatsWindow(this, true); + else if (GetTarget() && GetTarget()->IsPet()) + { + Pet *pet = (Pet *) GetTarget(); + pet->ShowInventory(this); + } else SendStatsWindow(this, true); return; From bb3596d24560e97a77a2e156ac28b64d2d2efd92 Mon Sep 17 00:00:00 2001 From: Paul Coene Date: Fri, 2 Mar 2018 19:14:48 -0500 Subject: [PATCH 2/5] Adjusted chances for apply slightly. --- zone/client_packet.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index c647bde78..6974f3861 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -2903,10 +2903,13 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) // Poisons that use this skill (old world poisons) almost // never fail to apply. I did 25 applies of a trivial 120+ // poison with an apply skill of 48 and they all worked. + // Also did 25 straight poisons at apply skill 248 for very + // high end and they never failed. + // Apply poison ranging from 1-9, 28/30 worked for a level 18.. // Poisons that don't proc until a level higher than the - // rogue simply won't apply at all, as done above now. + // rogue simply won't apply at all, no skill check done. - if (ChanceRoll < .90) { + if (ChanceRoll < (.9 + GetLevel()/1000) { ApplyPoisonSuccessResult = 1; AddProcToWeapon(poison->Proc.Effect, false, (GetDEX() / 100) + 103); @@ -10809,11 +10812,6 @@ void Client::Handle_OP_PopupResponse(const EQApplicationPacket *app) case POPUPID_UPDATE_SHOWSTATSWINDOW: if (GetTarget() && GetTarget()->IsClient()) GetTarget()->CastToClient()->SendStatsWindow(this, true); - else if (GetTarget() && GetTarget()->IsPet()) - { - Pet *pet = (Pet *) GetTarget(); - pet->ShowInventory(this); - } else SendStatsWindow(this, true); return; From 66ef95b9c97c95a06192c67cc152d3666b775780 Mon Sep 17 00:00:00 2001 From: Paul Coene Date: Fri, 2 Mar 2018 19:26:41 -0500 Subject: [PATCH 3/5] Missed a header file for poison commit --- zone/string_ids.h | 1 + 1 file changed, 1 insertion(+) diff --git a/zone/string_ids.h b/zone/string_ids.h index 997858bed..7786d12dc 100644 --- a/zone/string_ids.h +++ b/zone/string_ids.h @@ -120,6 +120,7 @@ #define FAIL_DISARM_DETECTED_TRAP 370 //You fail to disarm the detected trap. #define LOOT_LORE_ERROR 371 //You cannot loot this Lore Item. You already have one. #define PICK_LORE 379 //You cannot pick up a lore item you already possess. +#define POISON_TOO_HIGH 382 // This poison is too high level for you to apply. #define CONSENT_DENIED 390 //You do not have consent to summon that corpse. #define DISCIPLINE_RDY 393 //You are ready to use a new discipline now. #define CONSENT_INVALID_NAME 397 //Not a valid consent name. From 6fb3c66fe5fc717e7a70a95a1936a859ca246449 Mon Sep 17 00:00:00 2001 From: Paul Coene Date: Fri, 2 Mar 2018 20:08:06 -0500 Subject: [PATCH 4/5] Fixed last minute math change typo. --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 6974f3861..7e38d6363 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -2909,7 +2909,7 @@ void Client::Handle_OP_ApplyPoison(const EQApplicationPacket *app) // Poisons that don't proc until a level higher than the // rogue simply won't apply at all, no skill check done. - if (ChanceRoll < (.9 + GetLevel()/1000) { + if (ChanceRoll < (.9 + GetLevel()/1000)) { ApplyPoisonSuccessResult = 1; AddProcToWeapon(poison->Proc.Effect, false, (GetDEX() / 100) + 103); From b6679446129b5891164b8cac756412d7d0c5e2cd Mon Sep 17 00:00:00 2001 From: Paul Coene Date: Fri, 2 Mar 2018 20:13:24 -0500 Subject: [PATCH 5/5] Removed unneeded macro --- zone/client_packet.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 7e38d6363..34c1387b9 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -72,8 +72,6 @@ extern PetitionList petition_list; extern EntityList entity_list; typedef void (Client::*ClientPacketProc)(const EQApplicationPacket *app); -#define MIN(x,y) ((x) ConnectingOpcodes;