From a5020a68f05894eba0f9bc74e139e5655b118fb9 Mon Sep 17 00:00:00 2001 From: akkadius Date: Tue, 19 Aug 2014 10:55:29 -0500 Subject: [PATCH] Implemented a Stop_Return feature (Accidental item handin prevention) that will be symmetrically used with plugin::return_items that I am currently running live testing on EZ before releasing to EQEmu. This does not hurt to have this in the source. Fixed crash where 'attacker' validation is not being checked Removed petition console spam that does not follow traditional logging and is useless Made fix with SympatheticProcChances where it was checking for TempItem->Focus.Effect instead of TempItemAug->Focus.Effect --- changelog.txt | 6 +++++- zone/attack.cpp | 4 ++-- zone/client.cpp | 9 +++++++++ zone/exp.cpp | 9 +++++++++ zone/inventory.cpp | 10 ++++++++++ zone/petitions.cpp | 1 - zone/spell_effects.cpp | 2 +- zone/tasks.cpp | 1 + zone/trading.cpp | 10 ++++++++++ 9 files changed, 47 insertions(+), 5 deletions(-) diff --git a/changelog.txt b/changelog.txt index b63e8a5dc..2102ef251 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,10 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- -== 08/18/2014 == +== 08/19/2014 == +Akkadius: Implemented a Stop_Return feature (Accidental item handin prevention) that will be symmetrically used with plugin::return_items that I am currently running live testing on EZ before releasing to EQEmu. This does not hurt to have this in the source. +Akkadius: Fixed crash where 'attacker' validation is not being checked +Akkadius: Removed petition console spam that does not follow traditional logging and is useless +Akkadius: Made fix with SympatheticProcChances where it was checking for TempItem->Focus.Effect instead of TempItemAug->Focus.Effect== 08/18/2014 == Uleat: Fix for https://github.com/EQEmu/Server/issues/127 -- also activated a remarked action in doors.cpp to eliminate a memory leak. == 08/16/2014 == diff --git a/zone/attack.cpp b/zone/attack.cpp index 3195b4234..234149eff 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -3569,12 +3569,12 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons TryTriggerOnValueAmount(true); //fade mez if we are mezzed - if (IsMezzed()) { + if (IsMezzed() && attacker) { mlog(COMBAT__HITS, "Breaking mez due to attack."); entity_list.MessageClose_StringID(this, true, 100, MT_WornOff, HAS_BEEN_AWAKENED, GetCleanName(), attacker->GetCleanName()); BuffFadeByEffect(SE_Mez); - } + } //check stun chances if bashing if (damage > 0 && ((skill_used == SkillBash || skill_used == SkillKick) && attacker)) { diff --git a/zone/client.cpp b/zone/client.cpp index aa93478ba..0ac0671ef 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -2237,6 +2237,15 @@ void Client::AddMoneyToPP(uint64 copper, bool updateclient){ void Client::AddMoneyToPP(uint32 copper, uint32 silver, uint32 gold, uint32 platinum, bool updateclient){ + /* Set a timestamp in an entity variable for plugin check_handin.pl in return_items + This will stopgap players from items being returned if global_npc.pl has a catch all return_items + */ + struct timeval read_time; + char buffer[50]; + gettimeofday(&read_time, 0); + sprintf(buffer, "%i.%i \n", read_time.tv_sec, read_time.tv_usec); + this->SetEntityVariable("Stop_Return", buffer); + int32 new_value = m_pp.platinum + platinum; if(new_value >= 0 && new_value > m_pp.platinum) m_pp.platinum += platinum; diff --git a/zone/exp.cpp b/zone/exp.cpp index 5e8eb49f8..6553789d6 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -48,6 +48,15 @@ static uint32 MaxBankedRaidLeadershipPoints(int Level) void Client::AddEXP(uint32 in_add_exp, uint8 conlevel, bool resexp) { + /* Set a timestamp in an entity variable for plugin check_handin.pl in return_items + This will stopgap players from items being returned if global_npc.pl has a catch all return_items + */ + struct timeval read_time; + char buffer[50]; + gettimeofday(&read_time, 0); + sprintf(buffer, "%i.%i \n", read_time.tv_sec, read_time.tv_usec); + this->SetEntityVariable("Stop_Return", buffer); + uint32 add_exp = in_add_exp; if(!resexp && (XPRate != 0)) diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 9a815c6ca..76f0d9f87 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -200,6 +200,16 @@ bool Client::CheckLoreConflict(const Item_Struct* item) { } bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, bool attuned, uint16 to_slot) { + + /* Set a timestamp in an entity variable for plugin check_handin.pl in return_items + This will stopgap players from items being returned if global_npc.pl has a catch all return_items + */ + struct timeval read_time; + char buffer[50]; + gettimeofday(&read_time, 0); + sprintf(buffer, "%i.%i \n", read_time.tv_sec, read_time.tv_usec); + this->SetEntityVariable("Recieved_Item", buffer); + // TODO: update calling methods and script apis to handle a failure return const Item_Struct* item = database.GetItem(item_id); diff --git a/zone/petitions.cpp b/zone/petitions.cpp index 51910a052..040a1dfcf 100644 --- a/zone/petitions.cpp +++ b/zone/petitions.cpp @@ -298,7 +298,6 @@ void ZoneDatabase::RefreshPetitionsFromDB() newpet->SetUnavails(atoi(row[11])); newpet->SetSentTime2(atol(row[13])); newpet->SetGMText(row[14]); - std::cout << "Petition " << row[0] << " pettime = " << newpet->GetSentTime() << std::endl; if (atoi(row[12]) == 1) newpet->SetCheckedOut(true); else newpet->SetCheckedOut(false); petition_list.AddPetition(newpet); diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 8a45cf391..869e38619 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -5093,7 +5093,7 @@ int16 Client::GetSympatheticFocusEffect(focusType type, uint16 spell_id) { if (IsValidSpell(proc_spellid)){ - ProcChance = GetSympatheticProcChances(spell_id, spells[TempItem->Focus.Effect].base[0], TempItemAug->ProcRate); + ProcChance = GetSympatheticProcChances(spell_id, spells[TempItemAug->Focus.Effect].base[0], TempItemAug->ProcRate); if(MakeRandomFloat(0, 1) <= ProcChance) SympatheticProcList.push_back(proc_spellid); diff --git a/zone/tasks.cpp b/zone/tasks.cpp index 221085d4e..ddcabb3f4 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -33,6 +33,7 @@ Copyright (C) 2001-2008 EQEMu Development Team (http://eqemulator.net) #include "masterentity.h" #include "../common/features.h" #include "QuestParserCollection.h" +#include "mob.h" TaskManager::TaskManager() { diff --git a/zone/trading.cpp b/zone/trading.cpp index 8c564c130..1ace776a7 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -623,6 +623,16 @@ void Client::FinishTrade(Mob* tradingWith, ServerPacket* qspack, bool finalizer) if(UpdateTasksOnDeliver(items, Cash, tradingWith->GetNPCTypeID())) { if(!tradingWith->IsMoving()) tradingWith->FaceTarget(this); + + /* Set a timestamp in an entity variable for plugin check_handin.pl in return_items + This will stopgap players from items being returned if global_npc.pl has a catch all return_items + */ + struct timeval read_time; + char buffer[50]; + gettimeofday(&read_time, 0); + sprintf(buffer, "%i.%i \n", read_time.tv_sec, read_time.tv_usec); + this->SetEntityVariable("Stop_Return", buffer); + } }