Merge pull request #721 from noudess/master

Make old style rogue poison closer to live.
This commit is contained in:
Michael Cook (mackal) 2018-03-04 13:20:28 -05:00 committed by GitHub
commit bb3c0b41f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 22 deletions

View File

@ -72,6 +72,7 @@ extern PetitionList petition_list;
extern EntityList entity_list;
typedef void (Client::*ClientPacketProc)(const EQApplicationPacket *app);
//Use a map for connecting opcodes since it dosent get used a lot and is sparse
std::map<uint32, ClientPacketProc> ConnectingOpcodes;
//Use a static array for connected, for speed
@ -2861,41 +2862,60 @@ 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.
// 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, no skill check done.
if (ChanceRoll < SuccessChance) {
if (ChanceRoll < (.9 + GetLevel()/1000)) {
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));

View File

@ -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.