Merge of a monster

This commit is contained in:
KimLS
2017-04-02 20:03:51 -07:00
146 changed files with 10532 additions and 7432 deletions
+53 -51
View File
@@ -135,7 +135,7 @@ Client::Client(EQStreamInterface* ieqs)
forget_timer(0),
autosave_timer(RuleI(Character, AutosaveIntervalS) * 1000),
#ifdef REVERSE_AGGRO
scanarea_timer(RuleI(Aggro, ClientAggroCheckInterval) * 1000),
client_scan_npc_aggro_timer(RuleI(Aggro, ClientAggroCheckInterval) * 1000),
#endif
tribute_timer(Tribute_duration),
proximity_timer(ClientProximity_interval),
@@ -153,14 +153,14 @@ Client::Client(EQStreamInterface* ieqs)
anon_toggle_timer(250),
afk_toggle_timer(250),
helm_toggle_timer(250),
light_update_timer(600),
aggro_meter_timer(AGGRO_METER_UPDATE_MS),
m_Proximity(FLT_MAX, FLT_MAX, FLT_MAX), //arbitrary large number
m_ZoneSummonLocation(-2.0f,-2.0f,-2.0f),
m_AutoAttackPosition(0.0f, 0.0f, 0.0f, 0.0f),
m_AutoAttackTargetLocation(0.0f, 0.0f, 0.0f),
last_region_type(RegionTypeUnsupported),
m_dirtyautohaters(false)
m_dirtyautohaters(false),
npc_close_scan_timer(6000)
{
for(int cf=0; cf < _FilterCount; cf++)
ClientFilters[cf] = FilterShow;
@@ -176,6 +176,7 @@ Client::Client(EQStreamInterface* ieqs)
client_state = CLIENT_CONNECTING;
Trader=false;
Buyer = false;
Haste = 0;
CustomerID = 0;
TraderID = 0;
TrackingID = 0;
@@ -349,7 +350,7 @@ Client::~Client() {
ToggleBuyerMode(false);
if(conn_state != ClientConnectFinished) {
Log.Out(Logs::General, Logs::None, "Client '%s' was destroyed before reaching the connected state:", GetName());
Log(Logs::General, Logs::None, "Client '%s' was destroyed before reaching the connected state:", GetName());
ReportConnectingState();
}
@@ -358,6 +359,8 @@ Client::~Client() {
m_tradeskill_object = nullptr;
}
close_npcs.clear();
if(IsDueling() && GetDuelTarget() != 0) {
Entity* entity = entity_list.GetID(GetDuelTarget());
if(entity != nullptr && entity->IsClient()) {
@@ -508,31 +511,31 @@ void Client::SendLogoutPackets() {
void Client::ReportConnectingState() {
switch(conn_state) {
case NoPacketsReceived: //havent gotten anything
Log.Out(Logs::General, Logs::None, "Client has not sent us an initial zone entry packet.");
Log(Logs::General, Logs::None, "Client has not sent us an initial zone entry packet.");
break;
case ReceivedZoneEntry: //got the first packet, loading up PP
Log.Out(Logs::General, Logs::None, "Client sent initial zone packet, but we never got their player info from the database.");
Log(Logs::General, Logs::None, "Client sent initial zone packet, but we never got their player info from the database.");
break;
case PlayerProfileLoaded: //our DB work is done, sending it
Log.Out(Logs::General, Logs::None, "We were sending the player profile, tributes, tasks, spawns, time and weather, but never finished.");
Log(Logs::General, Logs::None, "We were sending the player profile, tributes, tasks, spawns, time and weather, but never finished.");
break;
case ZoneInfoSent: //includes PP, tributes, tasks, spawns, time and weather
Log.Out(Logs::General, Logs::None, "We successfully sent player info and spawns, waiting for client to request new zone.");
Log(Logs::General, Logs::None, "We successfully sent player info and spawns, waiting for client to request new zone.");
break;
case NewZoneRequested: //received and sent new zone request
Log.Out(Logs::General, Logs::None, "We received client's new zone request, waiting for client spawn request.");
Log(Logs::General, Logs::None, "We received client's new zone request, waiting for client spawn request.");
break;
case ClientSpawnRequested: //client sent ReqClientSpawn
Log.Out(Logs::General, Logs::None, "We received the client spawn request, and were sending objects, doors, zone points and some other stuff, but never finished.");
Log(Logs::General, Logs::None, "We received the client spawn request, and were sending objects, doors, zone points and some other stuff, but never finished.");
break;
case ZoneContentsSent: //objects, doors, zone points
Log.Out(Logs::General, Logs::None, "The rest of the zone contents were successfully sent, waiting for client ready notification.");
Log(Logs::General, Logs::None, "The rest of the zone contents were successfully sent, waiting for client ready notification.");
break;
case ClientReadyReceived: //client told us its ready, send them a bunch of crap like guild MOTD, etc
Log.Out(Logs::General, Logs::None, "We received client ready notification, but never finished Client::CompleteConnect");
Log(Logs::General, Logs::None, "We received client ready notification, but never finished Client::CompleteConnect");
break;
case ClientConnectFinished: //client finally moved to finished state, were done here
Log.Out(Logs::General, Logs::None, "Client is successfully connected.");
Log(Logs::General, Logs::None, "Client is successfully connected.");
break;
};
}
@@ -733,7 +736,7 @@ bool Client::SendAllPackets() {
if(eqs)
eqs->FastQueuePacket((EQApplicationPacket **)&cp->app, cp->ack_req);
iterator.RemoveCurrent();
Log.Out(Logs::Moderate, Logs::Client_Server_Packet, "Transmitting a packet");
Log(Logs::Moderate, Logs::Client_Server_Packet, "Transmitting a packet");
}
return true;
}
@@ -781,7 +784,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
char message[4096];
strn0cpy(message, orig_message, sizeof(message));
Log.Out(Logs::Detail, Logs::Zone_Server, "Client::ChannelMessageReceived() Channel:%i message:'%s'", chan_num, message);
Log(Logs::Detail, Logs::Zone_Server, "Client::ChannelMessageReceived() Channel:%i message:'%s'", chan_num, message);
if (targetname == nullptr) {
targetname = (!GetTarget()) ? "" : GetTarget()->GetName();
@@ -1216,7 +1219,7 @@ void Client::ChannelMessageSend(const char* from, const char* to, uint8 chan_num
QueuePacket(&app);
if ((chan_num == 2) && (ListenerSkill < 100)) { // group message in unmastered language, check for skill up
if ((m_pp.languages[language] <= lang_skill) && (from != this->GetName()))
if (m_pp.languages[language] <= lang_skill)
CheckLanguageSkillIncrease(language, lang_skill);
}
}
@@ -1607,7 +1610,7 @@ void Client::UpdateAdmin(bool iFromDB) {
if(m_pp.gm)
{
Log.Out(Logs::Moderate, Logs::Zone_Server, "%s - %s is a GM", __FUNCTION__ , GetName());
Log(Logs::Moderate, Logs::Zone_Server, "%s - %s is a GM", __FUNCTION__ , GetName());
// no need for this, having it set in pp you already start as gm
// and it's also set in your spawn packet so other people see it too
// SendAppearancePacket(AT_GM, 1, false);
@@ -2015,7 +2018,7 @@ void Client::ReadBook(BookRequest_Struct *book) {
if (booktxt2[0] != '\0') {
#if EQDEBUG >= 6
Log.Out(Logs::General, Logs::Normal, "Client::ReadBook() textfile:%s Text:%s", txtfile, booktxt2.c_str());
Log(Logs::General, Logs::Normal, "Client::ReadBook() textfile:%s Text:%s", txtfile, booktxt2.c_str());
#endif
auto outapp = new EQApplicationPacket(OP_ReadBook, length + sizeof(BookText_Struct));
@@ -2235,7 +2238,7 @@ void Client::AddMoneyToPP(uint64 copper, bool updateclient){
SaveCurrency();
Log.Out(Logs::General, Logs::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper);
Log(Logs::General, Logs::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i", GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper);
}
void Client::EVENT_ITEM_ScriptStopReturn(){
@@ -2275,7 +2278,7 @@ void Client::AddMoneyToPP(uint32 copper, uint32 silver, uint32 gold, uint32 plat
SaveCurrency();
#if (EQDEBUG>=5)
Log.Out(Logs::General, Logs::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i",
Log(Logs::General, Logs::None, "Client::AddMoneyToPP() %s should have: plat:%i gold:%i silver:%i copper:%i",
GetName(), m_pp.platinum, m_pp.gold, m_pp.silver, m_pp.copper);
#endif
}
@@ -2365,13 +2368,13 @@ bool Client::CheckIncreaseSkill(EQEmu::skills::SkillType skillid, Mob *against_w
if(zone->random.Real(0, 99) < Chance)
{
SetSkill(skillid, GetRawSkill(skillid) + 1);
Log.Out(Logs::Detail, Logs::Skills, "Skill %d at value %d successfully gain with %d%%chance (mod %d)", skillid, skillval, Chance, chancemodi);
Log(Logs::Detail, Logs::Skills, "Skill %d at value %d successfully gain with %d%%chance (mod %d)", skillid, skillval, Chance, chancemodi);
return true;
} else {
Log.Out(Logs::Detail, Logs::Skills, "Skill %d at value %d failed to gain with %d%%chance (mod %d)", skillid, skillval, Chance, chancemodi);
Log(Logs::Detail, Logs::Skills, "Skill %d at value %d failed to gain with %d%%chance (mod %d)", skillid, skillval, Chance, chancemodi);
}
} else {
Log.Out(Logs::Detail, Logs::Skills, "Skill %d at value %d cannot increase due to maxmum %d", skillid, skillval, maxskill);
Log(Logs::Detail, Logs::Skills, "Skill %d at value %d cannot increase due to maxmum %d", skillid, skillval, maxskill);
}
return false;
}
@@ -2392,10 +2395,10 @@ void Client::CheckLanguageSkillIncrease(uint8 langid, uint8 TeacherSkill) {
if(zone->random.Real(0,100) < Chance) { // if they make the roll
IncreaseLanguageSkill(langid); // increase the language skill by 1
Log.Out(Logs::Detail, Logs::Skills, "Language %d at value %d successfully gain with %.4f%%chance", langid, LangSkill, Chance);
Log(Logs::Detail, Logs::Skills, "Language %d at value %d successfully gain with %.4f%%chance", langid, LangSkill, Chance);
}
else
Log.Out(Logs::Detail, Logs::Skills, "Language %d at value %d failed to gain with %.4f%%chance", langid, LangSkill, Chance);
Log(Logs::Detail, Logs::Skills, "Language %d at value %d failed to gain with %.4f%%chance", langid, LangSkill, Chance);
}
}
@@ -2504,7 +2507,7 @@ uint16 Client::GetMaxSkillAfterSpecializationRules(EQEmu::skills::SkillType skil
Save();
Log.Out(Logs::General, Logs::Normal, "Reset %s's caster specialization skills to 1. "
Log(Logs::General, Logs::Normal, "Reset %s's caster specialization skills to 1. "
"Too many specializations skills were above 50.", GetCleanName());
}
@@ -4702,14 +4705,14 @@ void Client::HandleLDoNOpen(NPC *target)
{
if(target->GetClass() != LDON_TREASURE)
{
Log.Out(Logs::General, Logs::None, "%s tried to open %s but %s was not a treasure chest.",
Log(Logs::General, Logs::None, "%s tried to open %s but %s was not a treasure chest.",
GetName(), target->GetName(), target->GetName());
return;
}
if(DistanceSquaredNoZ(m_Position, target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse))
{
Log.Out(Logs::General, Logs::None, "%s tried to open %s but %s was out of range",
Log(Logs::General, Logs::None, "%s tried to open %s but %s was out of range",
GetName(), target->GetName(), target->GetName());
Message(13, "Treasure chest out of range.");
return;
@@ -6346,12 +6349,12 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid
PetRecord record;
if(!database.GetPetEntry(spells[spell_id].teleport_zone, &record))
{
Log.Out(Logs::General, Logs::Error, "Unknown doppelganger spell id: %d, check pets table", spell_id);
Log(Logs::General, Logs::Error, "Unknown doppelganger spell id: %d, check pets table", spell_id);
Message(13, "Unable to find data for pet %s", spells[spell_id].teleport_zone);
return;
}
AA_SwarmPet pet;
SwarmPet_Struct pet;
pet.count = pet_count;
pet.duration = pet_duration;
pet.npc_id = record.npc_type;
@@ -6360,7 +6363,7 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid
const NPCType *npc_type = database.LoadNPCTypesData(pet.npc_id);
if(npc_type == nullptr) {
Log.Out(Logs::General, Logs::Error, "Unknown npc type for doppelganger spell id: %d", spell_id);
Log(Logs::General, Logs::Error, "Unknown npc type for doppelganger spell id: %d", spell_id);
Message(0,"Unable to find pet!");
return;
}
@@ -6426,33 +6429,35 @@ void Client::Doppelganger(uint16 spell_id, Mob *target, const char *name_overrid
memcpy(npc_dup, made_npc, sizeof(NPCType));
}
NPC* npca = new NPC(
NPC* swarm_pet_npc = new NPC(
(npc_dup!=nullptr)?npc_dup:npc_type, //make sure we give the NPC the correct data pointer
0,
GetPosition() + glm::vec4(swarmPetLocations[summon_count], 0.0f, 0.0f),
FlyMode3);
if(!npca->GetSwarmInfo()){
auto nSI = new AA_SwarmPetInfo;
npca->SetSwarmInfo(nSI);
npca->GetSwarmInfo()->duration = new Timer(pet_duration*1000);
if(!swarm_pet_npc->GetSwarmInfo()){
auto nSI = new SwarmPet;
swarm_pet_npc->SetSwarmInfo(nSI);
swarm_pet_npc->GetSwarmInfo()->duration = new Timer(pet_duration*1000);
}
else{
npca->GetSwarmInfo()->duration->Start(pet_duration*1000);
swarm_pet_npc->GetSwarmInfo()->duration->Start(pet_duration*1000);
}
npca->GetSwarmInfo()->owner_id = GetID();
swarm_pet_npc->StartSwarmTimer(pet_duration * 1000);
swarm_pet_npc->GetSwarmInfo()->owner_id = GetID();
// Give the pets alittle more agro than the caster and then agro them on the target
target->AddToHateList(npca, (target->GetHateAmount(this) + 100), (target->GetDamageAmount(this) + 100));
npca->AddToHateList(target, 1000, 1000);
npca->GetSwarmInfo()->target = target->GetID();
target->AddToHateList(swarm_pet_npc, (target->GetHateAmount(this) + 100), (target->GetDamageAmount(this) + 100));
swarm_pet_npc->AddToHateList(target, 1000, 1000);
swarm_pet_npc->GetSwarmInfo()->target = target->GetID();
//we allocated a new NPC type object, give the NPC ownership of that memory
if(npc_dup != nullptr)
npca->GiveNPCTypeData(npc_dup);
swarm_pet_npc->GiveNPCTypeData(npc_dup);
entity_list.AddNPC(npca);
entity_list.AddNPC(swarm_pet_npc);
summon_count--;
}
}
@@ -7628,7 +7633,7 @@ void Client::SendMercPersonalInfo()
stancecount += zone->merc_stance_list[GetMercInfo().MercTemplateID].size();
if(stancecount > MAX_MERC_STANCES || mercCount > MAX_MERC || mercTypeCount > MAX_MERC_GRADES)
{
Log.Out(Logs::General, Logs::Mercenaries, "SendMercPersonalInfo canceled: (%i) (%i) (%i) for %s", stancecount, mercCount, mercTypeCount, GetName());
Log(Logs::General, Logs::Mercenaries, "SendMercPersonalInfo canceled: (%i) (%i) (%i) for %s", stancecount, mercCount, mercTypeCount, GetName());
SendMercMerchantResponsePacket(0);
return;
}
@@ -7724,13 +7729,13 @@ void Client::SendMercPersonalInfo()
return;
}
}
Log.Out(Logs::General, Logs::Mercenaries, "SendMercPersonalInfo Send Successful for %s.", GetName());
Log(Logs::General, Logs::Mercenaries, "SendMercPersonalInfo Send Successful for %s.", GetName());
SendMercMerchantResponsePacket(0);
}
else
{
Log.Out(Logs::General, Logs::Mercenaries, "SendMercPersonalInfo Send Failed Due to no MercData (%i) for %s", GetMercInfo().MercTemplateID, GetName());
Log(Logs::General, Logs::Mercenaries, "SendMercPersonalInfo Send Failed Due to no MercData (%i) for %s", GetMercInfo().MercTemplateID, GetName());
}
}
@@ -8498,7 +8503,7 @@ void Client::Consume(const EQEmu::ItemData *item, uint8 type, int16 slot, bool a
entity_list.MessageClose_StringID(this, true, 50, 0, EATING_MESSAGE, GetName(), item->Name);
#if EQDEBUG >= 5
Log.Out(Logs::General, Logs::None, "Eating from slot:%i", (int)slot);
Log(Logs::General, Logs::None, "Eating from slot:%i", (int)slot);
#endif
}
else
@@ -8515,7 +8520,7 @@ void Client::Consume(const EQEmu::ItemData *item, uint8 type, int16 slot, bool a
entity_list.MessageClose_StringID(this, true, 50, 0, DRINKING_MESSAGE, GetName(), item->Name);
#if EQDEBUG >= 5
Log.Out(Logs::General, Logs::None, "Drinking from slot:%i", (int)slot);
Log(Logs::General, Logs::None, "Drinking from slot:%i", (int)slot);
#endif
}
}
@@ -8653,9 +8658,6 @@ void Client::QuestReward(Mob* target, uint32 copper, uint32 silver, uint32 gold,
}
void Client::SendHPUpdateMarquee(){
if (!RuleB(Character, MarqueeHPUpdates))
return;
if (!this || !this->IsClient() || !this->cur_hp || !this->max_hp)
return;