diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 7c663f18e..368cdf931 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -831,17 +831,18 @@ struct BindStruct { /*008*/ float y; /*012*/ float z; /*016*/ float heading; - /*020*/ + /*020*/ uint32 instance_id; + /*024*/ }; struct SuspendedMinion_Struct { - /*000*/ uint16 SpellID; - /*002*/ uint32 HP; - /*006*/ uint32 Mana; - /*010*/ SpellBuff_Struct Buffs[BUFF_COUNT]; - /*510*/ uint32 Items[_MaterialCount]; - /*546*/ char Name[64]; + /*000*/ uint16 SpellID; + /*002*/ uint32 HP; + /*006*/ uint32 Mana; + /*010*/ SpellBuff_Struct Buffs[BUFF_COUNT]; + /*510*/ uint32 Items[_MaterialCount]; + /*546*/ char Name[64]; /*610*/ }; @@ -2663,6 +2664,17 @@ struct Translocate_Struct { /*088*/ uint32 Complete; }; +struct PendingTranslocate_Struct +{ + uint32 zone_id; + uint16 instance_id; + float heading; + float x; + float y; + float z; + uint32 spell_id; +}; + struct Sacrifice_Struct { /*000*/ uint32 CasterID; /*004*/ uint32 TargetID; diff --git a/world/worlddb.cpp b/world/worlddb.cpp index 3c9e3f128..955c0b897 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -222,15 +222,37 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* int WorldDatabase::MoveCharacterToBind(int CharID, uint8 bindnum) { /* if an invalid bind point is specified, use the primary bind */ - if (bindnum > 4){ bindnum = 0; } - int is_home = 0; - if (bindnum == 4){ is_home = 1; } - - std::string query = StringFormat("SELECT `zone_id` FROM `character_bind` WHERE `id` = %u AND `is_home` = %u LIMIT 1", CharID, is_home); - auto results = database.QueryDatabase(query); int i = 0; - for (auto row = results.begin(); row != results.end(); ++row) { - return atoi(row[0]); + if (bindnum > 4) + { + bindnum = 0; } + + std::string query = StringFormat("SELECT zone_id, instance_id, x, y, z FROM character_bind WHERE id = %u AND is_home = %u LIMIT 1", CharID, bindnum == 4 ? 1 : 0); + auto results = database.QueryDatabase(query); + if(!results.Success() || results.RowCount() == 0) { + return 0; + } + + int zone_id, instance_id; + double x, y, z, heading; + for (auto row = results.begin(); row != results.end(); ++row) { + zone_id = atoi(row[0]); + instance_id = atoi(row[1]); + x = atof(row[2]); + y = atof(row[3]); + z = atof(row[4]); + heading = atof(row[5]); + } + + query = StringFormat("UPDATE character_data SET zone_id = '%d', zone_instance = '%d', x = '%f', y = '%f', z = '%f', heading = '%f' WHERE id = %u", + zone_id, instance_id, x, y, z, heading, CharID); + + results = database.QueryDatabase(query); + if(!results.Success()) { + return 0; + } + + return zone_id; } bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* in_cc) @@ -239,7 +261,7 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* return false; in_pp->x = in_pp->y = in_pp->z = in_pp->heading = in_pp->zone_id = 0; - in_pp->binds[0].x = in_pp->binds[0].y = in_pp->binds[0].z = in_pp->binds[0].zoneId = 0; + in_pp->binds[0].x = in_pp->binds[0].y = in_pp->binds[0].z = in_pp->binds[0].zoneId = in_pp->binds[0].instance_id = 0; std::string query = StringFormat("SELECT x, y, z, heading, zone_id, bind_id " "FROM start_zones WHERE player_choice = % i " @@ -267,79 +289,79 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct* } case 1: { - in_pp->zone_id =2; // qeynos2 + in_pp->zone_id = 2; // qeynos2 in_pp->binds[0].zoneId = 2; // qeynos2 break; } case 2: { - in_pp->zone_id =29; // halas + in_pp->zone_id = 29; // halas in_pp->binds[0].zoneId = 30; // everfrost break; } case 3: { - in_pp->zone_id =19; // rivervale + in_pp->zone_id = 19; // rivervale in_pp->binds[0].zoneId = 20; // kithicor break; } case 4: { - in_pp->zone_id =9; // freportw + in_pp->zone_id = 9; // freportw in_pp->binds[0].zoneId = 9; // freportw break; } case 5: { - in_pp->zone_id =40; // neriaka + in_pp->zone_id = 40; // neriaka in_pp->binds[0].zoneId = 25; // nektulos break; } case 6: { - in_pp->zone_id =52; // gukta + in_pp->zone_id = 52; // gukta in_pp->binds[0].zoneId = 46; // innothule break; } case 7: { - in_pp->zone_id =49; // oggok + in_pp->zone_id = 49; // oggok in_pp->binds[0].zoneId = 47; // feerrott break; } case 8: { - in_pp->zone_id =60; // kaladima + in_pp->zone_id = 60; // kaladima in_pp->binds[0].zoneId = 68; // butcher break; } case 9: { - in_pp->zone_id =54; // gfaydark + in_pp->zone_id = 54; // gfaydark in_pp->binds[0].zoneId = 54; // gfaydark break; } case 10: { - in_pp->zone_id =61; // felwithea + in_pp->zone_id = 61; // felwithea in_pp->binds[0].zoneId = 54; // gfaydark break; } case 11: { - in_pp->zone_id =55; // akanon + in_pp->zone_id = 55; // akanon in_pp->binds[0].zoneId = 56; // steamfont break; } case 12: { - in_pp->zone_id =82; // cabwest + in_pp->zone_id = 82; // cabwest in_pp->binds[0].zoneId = 78; // fieldofbone break; } case 13: { - in_pp->zone_id =155; // sharvahl + in_pp->zone_id = 155; // sharvahl in_pp->binds[0].zoneId = 155; // sharvahl break; } @@ -378,7 +400,7 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru return false; in_pp->x = in_pp->y = in_pp->z = in_pp->heading = in_pp->zone_id = 0; - in_pp->binds[0].x = in_pp->binds[0].y = in_pp->binds[0].z = in_pp->binds[0].zoneId = 0; + in_pp->binds[0].x = in_pp->binds[0].y = in_pp->binds[0].z = in_pp->binds[0].zoneId = in_pp->binds[0].instance_id = 0; std::string query = StringFormat("SELECT x, y, z, heading, bind_id FROM start_zones WHERE zone_id = %i " "AND player_class = %i AND player_deity = %i AND player_race = %i", diff --git a/zone/attack.cpp b/zone/attack.cpp index 569466f68..da812e724 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1695,7 +1695,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes att dead_timer.Start(5000, true); m_pp.zone_id = m_pp.binds[0].zoneId; - m_pp.zoneInstance = 0; + m_pp.zoneInstance = m_pp.binds[0].instance_id; database.MoveCharacterToZone(this->CharacterID(), database.GetZoneName(m_pp.zone_id)); Save(); GoToDeath(); diff --git a/zone/client.cpp b/zone/client.cpp index 25dbb2840..3237240c9 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -398,7 +398,7 @@ Client::~Client() { if(IsHoveringForRespawn()) { m_pp.zone_id = m_pp.binds[0].zoneId; - m_pp.zoneInstance = 0; + m_pp.zoneInstance = m_pp.binds[0].instance_id; x_pos = m_pp.binds[0].x; y_pos = m_pp.binds[0].y; z_pos = m_pp.binds[0].z; @@ -543,11 +543,11 @@ bool Client::Save(uint8 iCommitNow) { m_pp.endurance = cur_end; /* Save Character Currency */ - database.SaveCharacterCurrency(this->CharacterID(), &m_pp); + database.SaveCharacterCurrency(CharacterID(), &m_pp); - /* Save Current Bind Points : Sets Instance to 0 because it is currently not implemented */ - database.SaveCharacterBindPoint(this->CharacterID(), m_pp.binds[0].zoneId, 0, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, 0, 0); /* Regular bind */ - database.SaveCharacterBindPoint(this->CharacterID(), m_pp.binds[4].zoneId, 0, m_pp.binds[4].x, m_pp.binds[4].y, m_pp.binds[4].z, 0, 1); /* Home Bind */ + /* Save Current Bind Points */ + database.SaveCharacterBindPoint(CharacterID(), m_pp.binds[0].zoneId, m_pp.binds[0].instance_id, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, 0, 0); /* Regular bind */ + database.SaveCharacterBindPoint(CharacterID(), m_pp.binds[4].zoneId, m_pp.binds[4].instance_id, m_pp.binds[4].x, m_pp.binds[4].y, m_pp.binds[4].z, 0, 1); /* Home Bind */ /* Save Character Buffs */ database.SaveBuffs(this); @@ -3848,7 +3848,8 @@ void Client::Sacrifice(Client *caster) void Client::SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID) { - if(!Caster || PendingTranslocate) return; + if(!Caster || PendingTranslocate) + return; const SPDat_Spell_Struct &Spell = spells[SpellID]; @@ -3856,26 +3857,29 @@ void Client::SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID) { Translocate_Struct *ts = (Translocate_Struct*)outapp->pBuffer; strcpy(ts->Caster, Caster->GetName()); - ts->SpellID = SpellID; + PendingTranslocateData.spell_id = ts->SpellID = SpellID; if((SpellID == 1422) || (SpellID == 1334) || (SpellID == 3243)) { - ts->ZoneID = m_pp.binds[0].zoneId; - ts->x = m_pp.binds[0].x; - ts->y = m_pp.binds[0].y; - ts->z = m_pp.binds[0].z; + PendingTranslocateData.zone_id = ts->ZoneID = m_pp.binds[0].zoneId; + PendingTranslocateData.instance_id = m_pp.binds[0].instance_id; + PendingTranslocateData.x = ts->x = m_pp.binds[0].x; + PendingTranslocateData.y = ts->y = m_pp.binds[0].y; + PendingTranslocateData.z = ts->z = m_pp.binds[0].z; + PendingTranslocateData.heading = m_pp.binds[0].heading; } else { ts->ZoneID = database.GetZoneID(Spell.teleport_zone); + PendingTranslocateData.instance_id = 0; ts->y = Spell.base[0]; ts->x = Spell.base[1]; ts->z = Spell.base[2]; + PendingTranslocateData.heading = 0.0; } ts->unknown008 = 0; ts->Complete = 0; - PendingTranslocateData = *ts; - PendingTranslocate=true; + PendingTranslocate = true; TranslocateTime = time(nullptr); QueuePacket(outapp); @@ -4473,7 +4477,8 @@ void Client::SendRespawnBinds() BindStruct* b = &m_pp.binds[0]; RespawnOption opt; opt.name = "Bind Location"; - opt.zoneid = b->zoneId; + opt.zone_id = b->zoneId; + opt.instance_id = b->instance_id; opt.x = b->x; opt.y = b->y; opt.z = b->z; @@ -4483,7 +4488,8 @@ void Client::SendRespawnBinds() //Rez is always added at the end RespawnOption rez; rez.name = "Resurrect"; - rez.zoneid = zone->GetZoneID(); + rez.zone_id = zone->GetZoneID(); + rez.instance_id = zone->GetInstanceID(); rez.x = GetX(); rez.y = GetY(); rez.z = GetZ(); @@ -4518,7 +4524,7 @@ void Client::SendRespawnBinds() { opt = &(*itr); VARSTRUCT_ENCODE_TYPE(uint32, buffer, count++); //option num (from 0) - VARSTRUCT_ENCODE_TYPE(uint32, buffer, opt->zoneid); + VARSTRUCT_ENCODE_TYPE(uint32, buffer, opt->zone_id); VARSTRUCT_ENCODE_TYPE(float, buffer, opt->x); VARSTRUCT_ENCODE_TYPE(float, buffer, opt->y); VARSTRUCT_ENCODE_TYPE(float, buffer, opt->z); @@ -4891,6 +4897,10 @@ void Client::SetStartZone(uint32 zoneid, float x, float y, float z) return; m_pp.binds[4].zoneId = zoneid; + if(zone->GetInstanceID() != 0 && zone->IsInstancePersistent()) { + m_pp.binds[4].instance_id = zone->GetInstanceID(); + } + if (x == 0 && y == 0 && z ==0) database.GetSafePoints(m_pp.binds[4].zoneId, 0, &m_pp.binds[4].x, &m_pp.binds[4].y, &m_pp.binds[4].z); else { @@ -7937,7 +7947,7 @@ void Client::SendItemScale(ItemInst *inst) { } } -void Client::AddRespawnOption(std::string option_name, uint32 zoneid, float x, float y, float z, float heading, bool initial_selection, int8 position) +void Client::AddRespawnOption(std::string option_name, uint32 zoneid, uint16 instance_id, float x, float y, float z, float heading, bool initial_selection, int8 position) { //If respawn window is already open, any changes would create an inconsistency with the client if (IsHoveringForRespawn()) { return; } @@ -7948,7 +7958,8 @@ void Client::AddRespawnOption(std::string option_name, uint32 zoneid, float x, f //Create respawn option RespawnOption res_opt; res_opt.name = option_name; - res_opt.zoneid = zoneid; + res_opt.zone_id = zoneid; + res_opt.instance_id = instance_id; res_opt.x = x; res_opt.y = y; res_opt.z = z; diff --git a/zone/client.h b/zone/client.h index 8407ff221..fd797c1b7 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1,4 +1,4 @@ -/* EQEMu: Everquest Server Emulator +/* EQEMu: Everquest Server Emulator Copyright (C) 2001-2003 EQEMu Development Team (http://eqemulator.org) This program is free software; you can redistribute it and/or modify @@ -61,10 +61,10 @@ class Client; #include -#define CLIENT_TIMEOUT 90000 -#define CLIENT_LD_TIMEOUT 30000 // length of time client stays in zone after LDing -#define TARGETING_RANGE 200 // range for /assist and /target -#define XTARGET_HARDCAP 20 +#define CLIENT_TIMEOUT 90000 +#define CLIENT_LD_TIMEOUT 30000 // length of time client stays in zone after LDing +#define TARGETING_RANGE 200 // range for /assist and /target +#define XTARGET_HARDCAP 20 extern Zone* zone; extern TaskManager *taskmanager; @@ -78,25 +78,25 @@ public: bool ack_req; }; -enum { //Type arguments to the Message* routines. +enum { //Type arguments to the Message* routines. //all not explicitly listed are the same grey color clientMessageWhite0 = 0, - clientMessageLoot = 2, //dark green - clientMessageTradeskill = 4, //light blue - clientMessageTell = 5, //magenta + clientMessageLoot = 2, //dark green + clientMessageTradeskill = 4, //light blue + clientMessageTell = 5, //magenta clientMessageWhite = 7, clientMessageWhite2 = 10, clientMessageLightGrey = 12, - clientMessageError = 13, //red + clientMessageError = 13, //red clientMessageGreen = 14, clientMessageYellow = 15, clientMessageBlue = 16, - clientMessageGroup = 18, //cyan + clientMessageGroup = 18, //cyan clientMessageWhite3 = 20, }; #define SPELLBAR_UNLOCK 0x2bc -enum { //scribing argument to MemorizeSpell +enum { //scribing argument to MemorizeSpell memSpellScribing = 0, memSpellMemorize = 1, memSpellForget = 2, @@ -105,14 +105,14 @@ enum { //scribing argument to MemorizeSpell //Modes for the zoning state of the client. typedef enum { - ZoneToSafeCoords, // Always send ZonePlayerToBind_Struct to client: Succor/Evac - GMSummon, // Always send ZonePlayerToBind_Struct to client: Only a GM Summon - ZoneToBindPoint, // Always send ZonePlayerToBind_Struct to client: Death Only - ZoneSolicited, // Always send ZonePlayerToBind_Struct to client: Portal, Translocate, Evac spells that have a x y z coord in the spell data + ZoneToSafeCoords, // Always send ZonePlayerToBind_Struct to client: Succor/Evac + GMSummon, // Always send ZonePlayerToBind_Struct to client: Only a GM Summon + ZoneToBindPoint, // Always send ZonePlayerToBind_Struct to client: Death Only + ZoneSolicited, // Always send ZonePlayerToBind_Struct to client: Portal, Translocate, Evac spells that have a x y z coord in the spell data ZoneUnsolicited, - GateToBindPoint, // Always send RequestClientZoneChange_Struct to client: Gate spell or Translocate To Bind Point spell - SummonPC, // In-zone GMMove() always: Call of the Hero spell or some other type of in zone only summons - Rewind, // Summon to /rewind location. + GateToBindPoint, // Always send RequestClientZoneChange_Struct to client: Gate spell or Translocate To Bind Point spell + SummonPC, // In-zone GMMove() always: Call of the Hero spell or some other type of in zone only summons + Rewind, // Summon to /rewind location. EvacToSafeCoords } ZoneMode; @@ -177,7 +177,8 @@ struct XTarget_Struct struct RespawnOption { std::string name; - uint32 zoneid; + uint32 zone_id; + uint16 instance_id; float x; float y; float z; @@ -221,176 +222,177 @@ public: virtual void SetAttackTimer(); float GetQuiverHaste(); - void AI_Init(); - void AI_Start(uint32 iMoveDelay = 0); - void AI_Stop(); - void AI_Process(); - void AI_SpellCast(); - void Trader_ShowItems(); - void Trader_CustomerBrowsing(Client *Customer); - void Trader_EndTrader(); - void Trader_StartTrader(); - uint8 WithCustomer(uint16 NewCustomer); - void KeyRingLoad(); - void KeyRingAdd(uint32 item_id); - bool KeyRingCheck(uint32 item_id); - void KeyRingList(); + void AI_Init(); + void AI_Start(uint32 iMoveDelay = 0); + void AI_Stop(); + void AI_Process(); + void AI_SpellCast(); + void Trader_ShowItems(); + void Trader_CustomerBrowsing(Client *Customer); + void Trader_EndTrader(); + void Trader_StartTrader(); + uint8 WithCustomer(uint16 NewCustomer); + void KeyRingLoad(); + void KeyRingAdd(uint32 item_id); + bool KeyRingCheck(uint32 item_id); + void KeyRingList(); virtual bool IsClient() const { return true; } - void CompleteConnect(); - bool TryStacking(ItemInst* item, uint8 type = ItemPacketTrade, bool try_worn = true, bool try_cursor = true); - void SendTraderPacket(Client* trader, uint32 Unknown72 = 51); - void SendBuyerPacket(Client* Buyer); + void CompleteConnect(); + bool TryStacking(ItemInst* item, uint8 type = ItemPacketTrade, bool try_worn = true, bool try_cursor = true); + void SendTraderPacket(Client* trader, uint32 Unknown72 = 51); + void SendBuyerPacket(Client* Buyer); GetItems_Struct* GetTraderItems(); - void SendBazaarWelcome(); - void DyeArmor(DyeStruct* dye); - uint8 SlotConvert(uint8 slot,bool bracer=false); - void Message_StringID(uint32 type, uint32 string_id, uint32 distance = 0); - void Message_StringID(uint32 type, uint32 string_id, const char* message,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0, uint32 distance = 0); - bool FilteredMessageCheck(Mob *sender, eqFilterType filter); - void FilteredMessage_StringID(Mob *sender, uint32 type, eqFilterType filter, uint32 string_id); - void FilteredMessage_StringID(Mob *sender, uint32 type, eqFilterType filter, + void SendBazaarWelcome(); + void DyeArmor(DyeStruct* dye); + uint8 SlotConvert(uint8 slot,bool bracer=false); + void Message_StringID(uint32 type, uint32 string_id, uint32 distance = 0); + void Message_StringID(uint32 type, uint32 string_id, const char* message,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0, uint32 distance = 0); + bool FilteredMessageCheck(Mob *sender, eqFilterType filter); + void FilteredMessage_StringID(Mob *sender, uint32 type, eqFilterType filter, uint32 string_id); + void FilteredMessage_StringID(Mob *sender, uint32 type, eqFilterType filter, uint32 string_id, const char *message1, const char *message2 = nullptr, const char *message3 = nullptr, const char *message4 = nullptr, const char *message5 = nullptr, const char *message6 = nullptr, const char *message7 = nullptr, const char *message8 = nullptr, const char *message9 = nullptr); - void Tell_StringID(uint32 string_id, const char *who, const char *message); - void SendColoredText(uint32 color, std::string message); - void SendBazaarResults(uint32 trader_id,uint32 class_,uint32 race,uint32 stat,uint32 slot,uint32 type,char name[64],uint32 minprice,uint32 maxprice); - void SendTraderItem(uint32 item_id,uint16 quantity); - uint16 FindTraderItem(int32 SerialNumber,uint16 Quantity); + void Tell_StringID(uint32 string_id, const char *who, const char *message); + void SendColoredText(uint32 color, std::string message); + void SendBazaarResults(uint32 trader_id,uint32 class_,uint32 race,uint32 stat,uint32 slot,uint32 type,char name[64],uint32 minprice,uint32 maxprice); + void SendTraderItem(uint32 item_id,uint16 quantity); + uint16 FindTraderItem(int32 SerialNumber,uint16 Quantity); ItemInst* FindTraderItemBySerialNumber(int32 SerialNumber); - void FindAndNukeTraderItem(int32 item_id,uint16 quantity,Client* customer,uint16 traderslot); - void NukeTraderItem(uint16 slot,int16 charges,uint16 quantity,Client* customer,uint16 traderslot, int uniqueid); - void ReturnTraderReq(const EQApplicationPacket* app,int16 traderitemcharges); - void TradeRequestFailed(const EQApplicationPacket* app); - void BuyTraderItem(TraderBuy_Struct* tbs,Client* trader,const EQApplicationPacket* app); - void TraderUpdate(uint16 slot_id,uint32 trader_id); - void FinishTrade(Mob* with, bool finalizer = false, void* event_entry = nullptr, std::list* event_details = nullptr); - void SendZonePoints(); + void FindAndNukeTraderItem(int32 item_id,uint16 quantity,Client* customer,uint16 traderslot); + void NukeTraderItem(uint16 slot,int16 charges,uint16 quantity,Client* customer,uint16 traderslot, int uniqueid); + void ReturnTraderReq(const EQApplicationPacket* app,int16 traderitemcharges); + void TradeRequestFailed(const EQApplicationPacket* app); + void BuyTraderItem(TraderBuy_Struct* tbs,Client* trader,const EQApplicationPacket* app); + void TraderUpdate(uint16 slot_id,uint32 trader_id); + void FinishTrade(Mob* with, bool finalizer = false, void* event_entry = nullptr, std::list* event_details = nullptr); + void SendZonePoints(); - void SendBuyerResults(char *SearchQuery, uint32 SearchID); - void ShowBuyLines(const EQApplicationPacket *app); - void SellToBuyer(const EQApplicationPacket *app); - void ToggleBuyerMode(bool TurnOn); - void UpdateBuyLine(const EQApplicationPacket *app); - void BuyerItemSearch(const EQApplicationPacket *app); - void SetBuyerWelcomeMessage(const char* WelcomeMessage) { BuyerWelcomeMessage = WelcomeMessage; } - const char* GetBuyerWelcomeMessage() { return BuyerWelcomeMessage.c_str(); } + void SendBuyerResults(char *SearchQuery, uint32 SearchID); + void ShowBuyLines(const EQApplicationPacket *app); + void SellToBuyer(const EQApplicationPacket *app); + void ToggleBuyerMode(bool TurnOn); + void UpdateBuyLine(const EQApplicationPacket *app); + void BuyerItemSearch(const EQApplicationPacket *app); + void SetBuyerWelcomeMessage(const char* WelcomeMessage) { BuyerWelcomeMessage = WelcomeMessage; } + const char* GetBuyerWelcomeMessage() { return BuyerWelcomeMessage.c_str(); } - void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho); + void FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho); virtual bool Process(); - void LogMerchant(Client* player, Mob* merchant, uint32 quantity, uint32 price, const Item_Struct* item, bool buying); - void SendPacketQueue(bool Block = true); - void QueuePacket(const EQApplicationPacket* app, bool ack_req = true, CLIENT_CONN_STATUS = CLIENT_CONNECTINGALL, eqFilterType filter=FilterNone); - void FastQueuePacket(EQApplicationPacket** app, bool ack_req = true, CLIENT_CONN_STATUS = CLIENT_CONNECTINGALL); - void ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_skill, const char* orig_message, const char* targetname=nullptr); - void ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, const char* message, ...); - void ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, uint8 lang_skill, const char* message, ...); - void Message(uint32 type, const char* message, ...); - void QuestJournalledMessage(const char *npcname, const char* message); - void VoiceMacroReceived(uint32 Type, char *Target, uint32 MacroNumber); - void SendSound(); - void LearnRecipe(uint32 recipeID); - bool CanIncreaseTradeskill(SkillUseTypes tradeskill); + void LogMerchant(Client* player, Mob* merchant, uint32 quantity, uint32 price, const Item_Struct* item, bool buying); + void SendPacketQueue(bool Block = true); + void QueuePacket(const EQApplicationPacket* app, bool ack_req = true, CLIENT_CONN_STATUS = CLIENT_CONNECTINGALL, eqFilterType filter=FilterNone); + void FastQueuePacket(EQApplicationPacket** app, bool ack_req = true, CLIENT_CONN_STATUS = CLIENT_CONNECTINGALL); + void ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_skill, const char* orig_message, const char* targetname=nullptr); + void ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, const char* message, ...); + void ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, uint8 lang_skill, const char* message, ...); + void Message(uint32 type, const char* message, ...); + void QuestJournalledMessage(const char *npcname, const char* message); + void VoiceMacroReceived(uint32 Type, char *Target, uint32 MacroNumber); + void SendSound(); + void LearnRecipe(uint32 recipeID); + bool CanIncreaseTradeskill(SkillUseTypes tradeskill); - EQApplicationPacket* ReturnItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType packet_type); + EQApplicationPacket* ReturnItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType packet_type); - bool GetRevoked() const { return revoked; } - void SetRevoked(bool rev) { revoked = rev; } - inline uint32 GetIP() const { return ip; } - inline bool GetHideMe() const { return gmhideme; } - void SetHideMe(bool hm); - inline uint16 GetPort() const { return port; } - bool IsDead() const { return(dead); } - bool IsUnconscious() const { return ((cur_hp <= 0) ? true : false); } - inline bool IsLFP() { return LFP; } - void UpdateLFP(); + bool GetRevoked() const { return revoked; } + void SetRevoked(bool rev) { revoked = rev; } + inline uint32 GetIP() const { return ip; } + inline bool GetHideMe() const { return gmhideme; } + void SetHideMe(bool hm); + inline uint16 GetPort() const { return port; } + bool IsDead() const { return(dead); } + bool IsUnconscious() const { return ((cur_hp <= 0) ? true : false); } + inline bool IsLFP() { return LFP; } + void UpdateLFP(); - virtual bool Save() { return Save(0); } - bool Save(uint8 iCommitNow); // 0 = delayed, 1=async now, 2=sync now - void SaveBackup(); + virtual bool Save() { return Save(0); } + bool Save(uint8 iCommitNow); // 0 = delayed, 1=async now, 2=sync now + void SaveBackup(); /* New PP Save Functions */ bool SaveCurrency(){ return database.SaveCharacterCurrency(this->CharacterID(), &m_pp); } bool SaveAA(); inline bool ClientDataLoaded() const { return client_data_loaded; } - inline bool Connected() const { return (client_state == CLIENT_CONNECTED); } - inline bool InZone() const { return (client_state == CLIENT_CONNECTED || client_state == CLIENT_LINKDEAD); } - inline void Kick() { client_state = CLIENT_KICKED; } - inline void Disconnect() { eqs->Close(); client_state = DISCONNECTED; } - inline bool IsLD() const { return (bool) (client_state == CLIENT_LINKDEAD); } - void WorldKick(); - inline uint8 GetAnon() const { return m_pp.anon; } - inline PlayerProfile_Struct& GetPP() { return m_pp; } + inline bool Connected() const { return (client_state == CLIENT_CONNECTED); } + inline bool InZone() const { return (client_state == CLIENT_CONNECTED || client_state == CLIENT_LINKDEAD); } + inline void Kick() { client_state = CLIENT_KICKED; } + inline void Disconnect() { eqs->Close(); client_state = DISCONNECTED; } + inline bool IsLD() const { return (bool) (client_state == CLIENT_LINKDEAD); } + void WorldKick(); + inline uint8 GetAnon() const { return m_pp.anon; } + inline PlayerProfile_Struct& GetPP() { return m_pp; } inline ExtendedProfile_Struct& GetEPP() { return m_epp; } - inline Inventory& GetInv() { return m_inv; } - inline const Inventory& GetInv() const { return m_inv; } - inline PetInfo* GetPetInfo(uint16 pet) { return (pet==1)?&m_suspendedminion:&m_petinfo; } + inline Inventory& GetInv() { return m_inv; } + inline const Inventory& GetInv() const { return m_inv; } + inline PetInfo* GetPetInfo(uint16 pet) { return (pet==1)?&m_suspendedminion:&m_petinfo; } inline InspectMessage_Struct& GetInspectMessage() { return m_inspect_message; } inline const InspectMessage_Struct& GetInspectMessage() const { return m_inspect_message; } - bool CheckAccess(int16 iDBLevel, int16 iDefaultLevel); + bool CheckAccess(int16 iDBLevel, int16 iDefaultLevel); - void CheckQuests(const char* zonename, const char* message, uint32 npc_id, uint32 item_id, Mob* other); - void LogLoot(Client* player,Corpse* corpse,const Item_Struct* item); - bool AutoAttackEnabled() const { return auto_attack; } - bool AutoFireEnabled() const { return auto_fire; } - void MakeCorpse(uint32 exploss); + void CheckQuests(const char* zonename, const char* message, uint32 npc_id, uint32 item_id, Mob* other); + void LogLoot(Client* player,Corpse* corpse,const Item_Struct* item); + bool AutoAttackEnabled() const { return auto_attack; } + bool AutoFireEnabled() const { return auto_fire; } + void MakeCorpse(uint32 exploss); - bool ChangeFirstName(const char* in_firstname,const char* gmname); + bool ChangeFirstName(const char* in_firstname,const char* gmname); - void Duck(); - void Stand(); + void Duck(); + void Stand(); - virtual void SetMaxHP(); - int32 LevelRegen(); - void HPTick(); - void SetGM(bool toggle); - void SetPVP(bool toggle); + virtual void SetMaxHP(); + int32 LevelRegen(); + void HPTick(); + void SetGM(bool toggle); + void SetPVP(bool toggle); - inline bool GetPVP() const { return zone->GetZoneID() == 77 ? true : (m_pp.pvp != 0); } - inline bool GetGM() const { return m_pp.gm != 0; } + inline bool GetPVP() const { return zone->GetZoneID() == 77 ? true : (m_pp.pvp != 0); } + inline bool GetGM() const { return m_pp.gm != 0; } - inline void SetBaseClass(uint32 i) { m_pp.class_=i; } - inline void SetBaseRace(uint32 i) { m_pp.race=i; } - inline void SetBaseGender(uint32 i) { m_pp.gender=i; } + inline void SetBaseClass(uint32 i) { m_pp.class_=i; } + inline void SetBaseRace(uint32 i) { m_pp.race=i; } + inline void SetBaseGender(uint32 i) { m_pp.gender=i; } inline void SetDeity(uint32 i) {m_pp.deity=i;deity=i;} - inline uint8 GetLevel2() const { return m_pp.level2; } - inline uint16 GetBaseRace() const { return m_pp.race; } - inline uint16 GetBaseClass() const { return m_pp.class_; } - inline uint8 GetBaseGender() const { return m_pp.gender; } - inline uint8 GetBaseFace() const { return m_pp.face; } - inline uint8 GetBaseHairColor() const { return m_pp.haircolor; } - inline uint8 GetBaseBeardColor() const { return m_pp.beardcolor; } - inline uint8 GetBaseEyeColor() const { return m_pp.eyecolor1; } - inline uint8 GetBaseHairStyle() const { return m_pp.hairstyle; } - inline uint8 GetBaseBeard() const { return m_pp.beard; } - inline uint8 GetBaseHeritage() const { return m_pp.drakkin_heritage; } - inline uint8 GetBaseTattoo() const { return m_pp.drakkin_tattoo; } - inline uint8 GetBaseDetails() const { return m_pp.drakkin_details; } - inline const float GetBindX(uint32 index = 0) const { return m_pp.binds[index].x; } - inline const float GetBindY(uint32 index = 0) const { return m_pp.binds[index].y; } - inline const float GetBindZ(uint32 index = 0) const { return m_pp.binds[index].z; } - inline const float GetBindHeading(uint32 index = 0) const { return m_pp.binds[index].heading; } - inline uint32 GetBindZoneID(uint32 index = 0) const { return m_pp.binds[index].zoneId; } - int32 CalcMaxMana(); - int32 CalcBaseMana(); - const int32& SetMana(int32 amount); - int32 CalcManaRegenCap(); + inline uint8 GetLevel2() const { return m_pp.level2; } + inline uint16 GetBaseRace() const { return m_pp.race; } + inline uint16 GetBaseClass() const { return m_pp.class_; } + inline uint8 GetBaseGender() const { return m_pp.gender; } + inline uint8 GetBaseFace() const { return m_pp.face; } + inline uint8 GetBaseHairColor() const { return m_pp.haircolor; } + inline uint8 GetBaseBeardColor() const { return m_pp.beardcolor; } + inline uint8 GetBaseEyeColor() const { return m_pp.eyecolor1; } + inline uint8 GetBaseHairStyle() const { return m_pp.hairstyle; } + inline uint8 GetBaseBeard() const { return m_pp.beard; } + inline uint8 GetBaseHeritage() const { return m_pp.drakkin_heritage; } + inline uint8 GetBaseTattoo() const { return m_pp.drakkin_tattoo; } + inline uint8 GetBaseDetails() const { return m_pp.drakkin_details; } + inline const float GetBindX(uint32 index = 0) const { return m_pp.binds[index].x; } + inline const float GetBindY(uint32 index = 0) const { return m_pp.binds[index].y; } + inline const float GetBindZ(uint32 index = 0) const { return m_pp.binds[index].z; } + inline const float GetBindHeading(uint32 index = 0) const { return m_pp.binds[index].heading; } + inline uint32 GetBindZoneID(uint32 index = 0) const { return m_pp.binds[index].zoneId; } + inline uint32 GetBindInstanceID(uint32 index = 0) const { return m_pp.binds[index].instance_id; } + int32 CalcMaxMana(); + int32 CalcBaseMana(); + const int32& SetMana(int32 amount); + int32 CalcManaRegenCap(); - void ServerFilter(SetServerFilter_Struct* filter); - void BulkSendTraderInventory(uint32 char_id); - void SendSingleTraderItem(uint32 char_id, int uniqueid); - void BulkSendMerchantInventory(int merchant_id, int npcid); + void ServerFilter(SetServerFilter_Struct* filter); + void BulkSendTraderInventory(uint32 char_id); + void SendSingleTraderItem(uint32 char_id, int uniqueid); + void BulkSendMerchantInventory(int merchant_id, int npcid); - inline uint8 GetLanguageSkill(uint16 n) const { return m_pp.languages[n]; } + inline uint8 GetLanguageSkill(uint16 n) const { return m_pp.languages[n]; } - void SendPickPocketResponse(Mob *from, uint32 amt, int type, const Item_Struct* item = nullptr); + void SendPickPocketResponse(Mob *from, uint32 amt, int type, const Item_Struct* item = nullptr); - inline const char* GetLastName() const { return lastname; } + inline const char* GetLastName() const { return lastname; } inline float ProximityX() const { return(proximity_x); } inline float ProximityY() const { return(proximity_y); } @@ -403,86 +405,86 @@ public: virtual void CalcBonuses(); //these are all precalculated now - inline virtual int32 GetAC() const { return AC; } + inline virtual int32 GetAC() const { return AC; } inline virtual int32 GetATK() const { return ATK + itembonuses.ATK + spellbonuses.ATK + ((GetSTR() + GetSkill(SkillOffense)) * 9 / 10); } inline virtual int32 GetATKBonus() const { return itembonuses.ATK + spellbonuses.ATK; } - inline virtual int GetHaste() const { return Haste; } + inline virtual int GetHaste() const { return Haste; } int GetRawACNoShield(int &shield_ac) const; - inline virtual int32 GetSTR() const { return STR; } - inline virtual int32 GetSTA() const { return STA; } - inline virtual int32 GetDEX() const { return DEX; } - inline virtual int32 GetAGI() const { return AGI; } - inline virtual int32 GetINT() const { return INT; } - inline virtual int32 GetWIS() const { return WIS; } - inline virtual int32 GetCHA() const { return CHA; } - inline virtual int32 GetMR() const { return MR; } - inline virtual int32 GetFR() const { return FR; } - inline virtual int32 GetDR() const { return DR; } - inline virtual int32 GetPR() const { return PR; } - inline virtual int32 GetCR() const { return CR; } - inline virtual int32 GetCorrup() const { return Corrup; } + inline virtual int32 GetSTR() const { return STR; } + inline virtual int32 GetSTA() const { return STA; } + inline virtual int32 GetDEX() const { return DEX; } + inline virtual int32 GetAGI() const { return AGI; } + inline virtual int32 GetINT() const { return INT; } + inline virtual int32 GetWIS() const { return WIS; } + inline virtual int32 GetCHA() const { return CHA; } + inline virtual int32 GetMR() const { return MR; } + inline virtual int32 GetFR() const { return FR; } + inline virtual int32 GetDR() const { return DR; } + inline virtual int32 GetPR() const { return PR; } + inline virtual int32 GetCR() const { return CR; } + inline virtual int32 GetCorrup() const { return Corrup; } - int32 GetMaxStat() const; - int32 GetMaxResist() const; - int32 GetMaxSTR() const; - int32 GetMaxSTA() const; - int32 GetMaxDEX() const; - int32 GetMaxAGI() const; - int32 GetMaxINT() const; - int32 GetMaxWIS() const; - int32 GetMaxCHA() const; - int32 GetMaxMR() const; - int32 GetMaxPR() const; - int32 GetMaxDR() const; - int32 GetMaxCR() const; - int32 GetMaxFR() const; - int32 GetMaxCorrup() const; - inline uint8 GetBaseSTR() const { return m_pp.STR; } - inline uint8 GetBaseSTA() const { return m_pp.STA; } - inline uint8 GetBaseCHA() const { return m_pp.CHA; } - inline uint8 GetBaseDEX() const { return m_pp.DEX; } - inline uint8 GetBaseINT() const { return m_pp.INT; } - inline uint8 GetBaseAGI() const { return m_pp.AGI; } - inline uint8 GetBaseWIS() const { return m_pp.WIS; } - inline uint8 GetBaseCorrup() const { return 15; } // Same for all + int32 GetMaxStat() const; + int32 GetMaxResist() const; + int32 GetMaxSTR() const; + int32 GetMaxSTA() const; + int32 GetMaxDEX() const; + int32 GetMaxAGI() const; + int32 GetMaxINT() const; + int32 GetMaxWIS() const; + int32 GetMaxCHA() const; + int32 GetMaxMR() const; + int32 GetMaxPR() const; + int32 GetMaxDR() const; + int32 GetMaxCR() const; + int32 GetMaxFR() const; + int32 GetMaxCorrup() const; + inline uint8 GetBaseSTR() const { return m_pp.STR; } + inline uint8 GetBaseSTA() const { return m_pp.STA; } + inline uint8 GetBaseCHA() const { return m_pp.CHA; } + inline uint8 GetBaseDEX() const { return m_pp.DEX; } + inline uint8 GetBaseINT() const { return m_pp.INT; } + inline uint8 GetBaseAGI() const { return m_pp.AGI; } + inline uint8 GetBaseWIS() const { return m_pp.WIS; } + inline uint8 GetBaseCorrup() const { return 15; } // Same for all - inline virtual int32 GetHeroicSTR() const { return itembonuses.HeroicSTR; } - inline virtual int32 GetHeroicSTA() const { return itembonuses.HeroicSTA; } - inline virtual int32 GetHeroicDEX() const { return itembonuses.HeroicDEX; } - inline virtual int32 GetHeroicAGI() const { return itembonuses.HeroicAGI; } - inline virtual int32 GetHeroicINT() const { return itembonuses.HeroicINT; } - inline virtual int32 GetHeroicWIS() const { return itembonuses.HeroicWIS; } - inline virtual int32 GetHeroicCHA() const { return itembonuses.HeroicCHA; } - inline virtual int32 GetHeroicMR() const { return itembonuses.HeroicMR; } - inline virtual int32 GetHeroicFR() const { return itembonuses.HeroicFR; } - inline virtual int32 GetHeroicDR() const { return itembonuses.HeroicDR; } - inline virtual int32 GetHeroicPR() const { return itembonuses.HeroicPR; } - inline virtual int32 GetHeroicCR() const { return itembonuses.HeroicCR; } - inline virtual int32 GetHeroicCorrup() const { return itembonuses.HeroicCorrup; } + inline virtual int32 GetHeroicSTR() const { return itembonuses.HeroicSTR; } + inline virtual int32 GetHeroicSTA() const { return itembonuses.HeroicSTA; } + inline virtual int32 GetHeroicDEX() const { return itembonuses.HeroicDEX; } + inline virtual int32 GetHeroicAGI() const { return itembonuses.HeroicAGI; } + inline virtual int32 GetHeroicINT() const { return itembonuses.HeroicINT; } + inline virtual int32 GetHeroicWIS() const { return itembonuses.HeroicWIS; } + inline virtual int32 GetHeroicCHA() const { return itembonuses.HeroicCHA; } + inline virtual int32 GetHeroicMR() const { return itembonuses.HeroicMR; } + inline virtual int32 GetHeroicFR() const { return itembonuses.HeroicFR; } + inline virtual int32 GetHeroicDR() const { return itembonuses.HeroicDR; } + inline virtual int32 GetHeroicPR() const { return itembonuses.HeroicPR; } + inline virtual int32 GetHeroicCR() const { return itembonuses.HeroicCR; } + inline virtual int32 GetHeroicCorrup() const { return itembonuses.HeroicCorrup; } // Mod2 - inline virtual int32 GetShielding() const { return itembonuses.MeleeMitigation; } - inline virtual int32 GetSpellShield() const { return itembonuses.SpellShield; } - inline virtual int32 GetDoTShield() const { return itembonuses.DoTShielding; } - inline virtual int32 GetStunResist() const { return itembonuses.StunResist; } - inline virtual int32 GetStrikeThrough() const { return itembonuses.StrikeThrough; } - inline virtual int32 GetAvoidance() const { return itembonuses.AvoidMeleeChance; } - inline virtual int32 GetAccuracy() const { return itembonuses.HitChance; } - inline virtual int32 GetCombatEffects() const { return itembonuses.ProcChance; } - inline virtual int32 GetDS() const { return itembonuses.DamageShield; } + inline virtual int32 GetShielding() const { return itembonuses.MeleeMitigation; } + inline virtual int32 GetSpellShield() const { return itembonuses.SpellShield; } + inline virtual int32 GetDoTShield() const { return itembonuses.DoTShielding; } + inline virtual int32 GetStunResist() const { return itembonuses.StunResist; } + inline virtual int32 GetStrikeThrough() const { return itembonuses.StrikeThrough; } + inline virtual int32 GetAvoidance() const { return itembonuses.AvoidMeleeChance; } + inline virtual int32 GetAccuracy() const { return itembonuses.HitChance; } + inline virtual int32 GetCombatEffects() const { return itembonuses.ProcChance; } + inline virtual int32 GetDS() const { return itembonuses.DamageShield; } // Mod3 - inline virtual int32 GetHealAmt() const { return itembonuses.HealAmt; } - inline virtual int32 GetSpellDmg() const { return itembonuses.SpellDmg; } - inline virtual int32 GetClair() const { return itembonuses.Clairvoyance; } - inline virtual int32 GetDSMit() const { return itembonuses.DSMitigation; } + inline virtual int32 GetHealAmt() const { return itembonuses.HealAmt; } + inline virtual int32 GetSpellDmg() const { return itembonuses.SpellDmg; } + inline virtual int32 GetClair() const { return itembonuses.Clairvoyance; } + inline virtual int32 GetDSMit() const { return itembonuses.DSMitigation; } - inline virtual int32 GetSingMod() const { return itembonuses.singingMod; } - inline virtual int32 GetBrassMod() const { return itembonuses.brassMod; } - inline virtual int32 GetPercMod() const { return itembonuses.percussionMod; } - inline virtual int32 GetStringMod() const { return itembonuses.stringedMod; } - inline virtual int32 GetWindMod() const { return itembonuses.windMod; } + inline virtual int32 GetSingMod() const { return itembonuses.singingMod; } + inline virtual int32 GetBrassMod() const { return itembonuses.brassMod; } + inline virtual int32 GetPercMod() const { return itembonuses.percussionMod; } + inline virtual int32 GetStringMod() const { return itembonuses.stringedMod; } + inline virtual int32 GetWindMod() const { return itembonuses.windMod; } - inline virtual int32 GetDelayDeath() const { return aabonuses.DelayDeath + spellbonuses.DelayDeath + itembonuses.DelayDeath + 11; } + inline virtual int32 GetDelayDeath() const { return aabonuses.DelayDeath + spellbonuses.DelayDeath + itembonuses.DelayDeath + 11; } float GetActSpellRange(uint16 spell_id, float range, bool IsBard = false); int32 GetActSpellDamage(uint16 spell_id, int32 value, Mob* target = nullptr); @@ -504,29 +506,29 @@ public: virtual void InitializeBuffSlots(); virtual void UninitializeBuffSlots(); - inline const int32 GetBaseHP() const { return base_hp; } + inline const int32 GetBaseHP() const { return base_hp; } uint32 GetWeight() const { return(weight); } inline void RecalcWeight() { weight = CalcCurrentWeight(); } uint32 CalcCurrentWeight(); - inline uint32 GetCopper() const { return m_pp.copper; } - inline uint32 GetSilver() const { return m_pp.silver; } - inline uint32 GetGold() const { return m_pp.gold; } - inline uint32 GetPlatinum() const { return m_pp.platinum; } + inline uint32 GetCopper() const { return m_pp.copper; } + inline uint32 GetSilver() const { return m_pp.silver; } + inline uint32 GetGold() const { return m_pp.gold; } + inline uint32 GetPlatinum() const { return m_pp.platinum; } /*Endurance and such*/ - void CalcMaxEndurance(); //This calculates the maximum endurance we can have - int32 CalcBaseEndurance(); //Calculates Base End - int32 CalcEnduranceRegen(); //Calculates endurance regen used in DoEnduranceRegen() - int32 GetEndurance() const {return cur_end;} //This gets our current endurance - int32 GetMaxEndurance() const {return max_end;} //This gets our endurance from the last CalcMaxEndurance() call - int32 CalcEnduranceRegenCap(); - int32 CalcHPRegenCap(); + void CalcMaxEndurance(); //This calculates the maximum endurance we can have + int32 CalcBaseEndurance(); //Calculates Base End + int32 CalcEnduranceRegen(); //Calculates endurance regen used in DoEnduranceRegen() + int32 GetEndurance() const {return cur_end;} //This gets our current endurance + int32 GetMaxEndurance() const {return max_end;} //This gets our endurance from the last CalcMaxEndurance() call + int32 CalcEnduranceRegenCap(); + int32 CalcHPRegenCap(); inline uint8 GetEndurancePercent() { return (uint8)((float)cur_end / (float)max_end * 100.0f); } - void SetEndurance(int32 newEnd); //This sets the current endurance to the new value - void DoEnduranceRegen(); //This Regenerates endurance - void DoEnduranceUpkeep(); //does the endurance upkeep + void SetEndurance(int32 newEnd); //This sets the current endurance to the new value + void DoEnduranceRegen(); //This Regenerates endurance + void DoEnduranceUpkeep(); //does the endurance upkeep //This calculates total Attack Rating to match very close to what the client should show uint32 GetTotalATK(); @@ -538,153 +540,155 @@ public: bool Rampage(); void DurationRampage(uint32 duration); - inline uint32 GetEXP() const { return m_pp.exp; } + inline uint32 GetEXP() const { return m_pp.exp; } - bool UpdateLDoNPoints(int32 points, uint32 theme); - void SetPVPPoints(uint32 Points) { m_pp.PVPCurrentPoints = Points; } - uint32 GetPVPPoints() { return m_pp.PVPCurrentPoints; } - void AddPVPPoints(uint32 Points); - uint32 GetRadiantCrystals() { return m_pp.currentRadCrystals; } - void SetRadiantCrystals(uint32 Crystals) { m_pp.currentRadCrystals = Crystals; } - uint32 GetEbonCrystals() { return m_pp.currentEbonCrystals; } - void SetEbonCrystals(uint32 Crystals) { m_pp.currentEbonCrystals = Crystals; } - void AddCrystals(uint32 Radiant, uint32 Ebon); - void SendCrystalCounts(); + bool UpdateLDoNPoints(int32 points, uint32 theme); + void SetPVPPoints(uint32 Points) { m_pp.PVPCurrentPoints = Points; } + uint32 GetPVPPoints() { return m_pp.PVPCurrentPoints; } + void AddPVPPoints(uint32 Points); + uint32 GetRadiantCrystals() { return m_pp.currentRadCrystals; } + void SetRadiantCrystals(uint32 Crystals) { m_pp.currentRadCrystals = Crystals; } + uint32 GetEbonCrystals() { return m_pp.currentEbonCrystals; } + void SetEbonCrystals(uint32 Crystals) { m_pp.currentEbonCrystals = Crystals; } + void AddCrystals(uint32 Radiant, uint32 Ebon); + void SendCrystalCounts(); - void AddEXP(uint32 in_add_exp, uint8 conlevel = 0xFF, bool resexp = false); - void SetEXP(uint32 set_exp, uint32 set_aaxp, bool resexp=false); - void AddLevelBasedExp(uint8 exp_percentage, uint8 max_level=0); - void SetLeadershipEXP(uint32 group_exp, uint32 raid_exp); - void AddLeadershipEXP(uint32 group_exp, uint32 raid_exp); - void SendLeadershipEXPUpdate(); - bool IsLeadershipEXPOn(); - inline int GetLeadershipAA(int AAID) { return m_pp.leader_abilities.ranks[AAID]; } - inline LeadershipAA_Struct &GetLeadershipAA() { return m_pp.leader_abilities; } - inline GroupLeadershipAA_Struct &GetGroupLeadershipAA() { return m_pp.leader_abilities.group; } - inline RaidLeadershipAA_Struct &GetRaidLeadershipAA() { return m_pp.leader_abilities.raid; } - int GroupLeadershipAAHealthEnhancement(); - int GroupLeadershipAAManaEnhancement(); - int GroupLeadershipAAHealthRegeneration(); - int GroupLeadershipAAOffenseEnhancement(); - void InspectBuffs(Client* Inspector, int Rank); - uint32 GetRaidPoints() { return(m_pp.raid_leadership_points); } - uint32 GetGroupPoints() { return(m_pp.group_leadership_points); } - uint32 GetRaidEXP() { return(m_pp.raid_leadership_exp); } - uint32 GetGroupEXP() { return(m_pp.group_leadership_exp); } - uint32 GetTotalSecondsPlayed() { return(TotalSecondsPlayed); } + void AddEXP(uint32 in_add_exp, uint8 conlevel = 0xFF, bool resexp = false); + void SetEXP(uint32 set_exp, uint32 set_aaxp, bool resexp=false); + void AddLevelBasedExp(uint8 exp_percentage, uint8 max_level=0); + void SetLeadershipEXP(uint32 group_exp, uint32 raid_exp); + void AddLeadershipEXP(uint32 group_exp, uint32 raid_exp); + void SendLeadershipEXPUpdate(); + bool IsLeadershipEXPOn(); + inline int GetLeadershipAA(int AAID) { return m_pp.leader_abilities.ranks[AAID]; } + inline LeadershipAA_Struct &GetLeadershipAA() { return m_pp.leader_abilities; } + inline GroupLeadershipAA_Struct &GetGroupLeadershipAA() { return m_pp.leader_abilities.group; } + inline RaidLeadershipAA_Struct &GetRaidLeadershipAA() { return m_pp.leader_abilities.raid; } + int GroupLeadershipAAHealthEnhancement(); + int GroupLeadershipAAManaEnhancement(); + int GroupLeadershipAAHealthRegeneration(); + int GroupLeadershipAAOffenseEnhancement(); + void InspectBuffs(Client* Inspector, int Rank); + uint32 GetRaidPoints() { return(m_pp.raid_leadership_points); } + uint32 GetGroupPoints() { return(m_pp.group_leadership_points); } + uint32 GetRaidEXP() { return(m_pp.raid_leadership_exp); } + uint32 GetGroupEXP() { return(m_pp.group_leadership_exp); } + uint32 GetTotalSecondsPlayed() { return(TotalSecondsPlayed); } virtual void SetLevel(uint8 set_level, bool command = false); - void GoToBind(uint8 bindnum = 0); - void GoToSafeCoords(uint16 zone_id, uint16 instance_id); - void Gate(); - void SetBindPoint(int to_zone = -1, float new_x = 0.0f, float new_y = 0.0f, float new_z = 0.0f); - void SetStartZone(uint32 zoneid, float x = 0.0f, float y =0.0f, float z = 0.0f); - uint32 GetStartZone(void); - void MovePC(const char* zonename, float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); - void MovePC(uint32 zoneID, float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); - void MovePC(float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); - void MovePC(uint32 zoneID, uint32 instanceID, float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); - void AssignToInstance(uint16 instance_id); - void RemoveFromInstance(uint16 instance_id); - void WhoAll(); - bool CheckLoreConflict(const Item_Struct* item); - void ChangeLastName(const char* in_lastname); - void GetGroupAAs(GroupLeadershipAA_Struct *into) const; - void GetRaidAAs(RaidLeadershipAA_Struct *into) const; - void ClearGroupAAs(); - void UpdateGroupAAs(int32 points, uint32 type); - void SacrificeConfirm(Client* caster); - void Sacrifice(Client* caster); - void GoToDeath(); - inline const int32 GetInstanceID() const { return zone->GetInstanceID(); } - FACTION_VALUE GetReverseFactionCon(Mob* iOther); - FACTION_VALUE GetFactionLevel(uint32 char_id, uint32 npc_id, uint32 p_race, uint32 p_class, uint32 p_deity, int32 pFaction, Mob* tnpc); - int32 GetCharacterFactionLevel(int32 faction_id); - int32 GetModCharacterFactionLevel(int32 faction_id); - void MerchantRejectMessage(Mob *merchant, int primaryfaction); - void SendFactionMessage(int32 tmpvalue, int32 faction_id, int32 totalvalue, uint8 temp); + void GoToBind(uint8 bindnum = 0); + void GoToSafeCoords(uint16 zone_id, uint16 instance_id); + void Gate(); + void SetBindPoint(int to_zone = -1, int to_instance = 0, float new_x = 0.0f, float new_y = 0.0f, float new_z = 0.0f); + void SetStartZone(uint32 zoneid, float x = 0.0f, float y =0.0f, float z = 0.0f); + uint32 GetStartZone(void); + void MovePC(const char* zonename, float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); + void MovePC(uint32 zoneID, float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); + void MovePC(float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); + void MovePC(uint32 zoneID, uint32 instanceID, float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); + void AssignToInstance(uint16 instance_id); + void RemoveFromInstance(uint16 instance_id); + void WhoAll(); + bool CheckLoreConflict(const Item_Struct* item); + void ChangeLastName(const char* in_lastname); + void GetGroupAAs(GroupLeadershipAA_Struct *into) const; + void GetRaidAAs(RaidLeadershipAA_Struct *into) const; + void ClearGroupAAs(); + void UpdateGroupAAs(int32 points, uint32 type); + void SacrificeConfirm(Client* caster); + void Sacrifice(Client* caster); + void GoToDeath(); + inline const int32 GetInstanceID() const { return zone->GetInstanceID(); } - void SetFactionLevel(uint32 char_id, uint32 npc_id, uint8 char_class, uint8 char_race, uint8 char_deity); - void SetFactionLevel2(uint32 char_id, int32 faction_id, uint8 char_class, uint8 char_race, uint8 char_deity, int32 value, uint8 temp); - int32 GetRawItemAC(); - uint16 GetCombinedAC_TEST(); + FACTION_VALUE GetReverseFactionCon(Mob* iOther); + FACTION_VALUE GetFactionLevel(uint32 char_id, uint32 npc_id, uint32 p_race, uint32 p_class, uint32 p_deity, int32 pFaction, Mob* tnpc); + int32 GetCharacterFactionLevel(int32 faction_id); + int32 GetModCharacterFactionLevel(int32 faction_id); + void MerchantRejectMessage(Mob *merchant, int primaryfaction); + void SendFactionMessage(int32 tmpvalue, int32 faction_id, int32 totalvalue, uint8 temp); + + void SetFactionLevel(uint32 char_id, uint32 npc_id, uint8 char_class, uint8 char_race, uint8 char_deity); + void SetFactionLevel2(uint32 char_id, int32 faction_id, uint8 char_class, uint8 char_race, uint8 char_deity, int32 value, uint8 temp); + int32 GetRawItemAC(); + uint16 GetCombinedAC_TEST(); + + inline uint32 LSAccountID() const { return lsaccountid; } + inline uint32 GetWID() const { return WID; } + inline void SetWID(uint32 iWID) { WID = iWID; } + inline uint32 AccountID() const { return account_id; } - inline uint32 LSAccountID() const { return lsaccountid; } - inline uint32 GetWID() const { return WID; } - inline void SetWID(uint32 iWID) { WID = iWID; } - inline uint32 AccountID() const { return account_id; } inline const char* AccountName()const { return account_name; } - inline int16 Admin() const { return admin; } - inline uint32 CharacterID() const { return character_id; } - void UpdateAdmin(bool iFromDB = true); - void UpdateWho(uint8 remove = 0); - bool GMHideMe(Client* client = 0); + inline int16 Admin() const { return admin; } + inline uint32 CharacterID() const { return character_id; } + void UpdateAdmin(bool iFromDB = true); + void UpdateWho(uint8 remove = 0); + bool GMHideMe(Client* client = 0); inline bool IsInAGuild() const { return(guild_id != GUILD_NONE && guild_id != 0); } inline bool IsInGuild(uint32 in_gid) const { return(in_gid == guild_id && IsInAGuild()); } - inline uint32 GuildID() const { return guild_id; } - inline uint8 GuildRank() const { return guildrank; } - void SendGuildMOTD(bool GetGuildMOTDReply = false); - void SendGuildURL(); - void SendGuildChannel(); - void SendGuildSpawnAppearance(); - void SendGuildRanks(); - void SendGuildMembers(); - void SendGuildList(); - void SendGuildJoin(GuildJoin_Struct* gj); - void RefreshGuildInfo(); + inline uint32 GuildID() const { return guild_id; } + inline uint8 GuildRank() const { return guildrank; } + void SendGuildMOTD(bool GetGuildMOTDReply = false); + void SendGuildURL(); + void SendGuildChannel(); + void SendGuildSpawnAppearance(); + void SendGuildRanks(); + void SendGuildMembers(); + void SendGuildList(); + void SendGuildJoin(GuildJoin_Struct* gj); + void RefreshGuildInfo(); - void SendManaUpdatePacket(); - void SendManaUpdate(); - void SendEnduranceUpdate(); - uint8 GetFace() const { return m_pp.face; } - void WhoAll(Who_All_Struct* whom); - void FriendsWho(char *FriendsString); + void SendManaUpdatePacket(); + void SendManaUpdate(); + void SendEnduranceUpdate(); + uint8 GetFace() const { return m_pp.face; } + void WhoAll(Who_All_Struct* whom); + void FriendsWho(char *FriendsString); - void Stun(int duration); - void UnStun(); - void ReadBook(BookRequest_Struct *book); - void QuestReadBook(const char* text, uint8 type); - void SendClientMoneyUpdate(uint8 type,uint32 amount); - void SendMoneyUpdate(); - bool TakeMoneyFromPP(uint64 copper, bool updateclient=false); - void AddMoneyToPP(uint64 copper,bool updateclient); - void AddMoneyToPP(uint32 copper, uint32 silver, uint32 gold,uint32 platinum,bool updateclient); - bool HasMoney(uint64 copper); - uint64 GetCarriedMoney(); - uint64 GetAllMoney(); + void Stun(int duration); + void UnStun(); + void ReadBook(BookRequest_Struct *book); + void QuestReadBook(const char* text, uint8 type); + void SendClientMoneyUpdate(uint8 type,uint32 amount); + void SendMoneyUpdate(); + bool TakeMoneyFromPP(uint64 copper, bool updateclient=false); + void AddMoneyToPP(uint64 copper,bool updateclient); + void AddMoneyToPP(uint32 copper, uint32 silver, uint32 gold,uint32 platinum,bool updateclient); + bool HasMoney(uint64 copper); + uint64 GetCarriedMoney(); + uint64 GetAllMoney(); - bool IsDiscovered(uint32 itemid); - void DiscoverItem(uint32 itemid); + bool IsDiscovered(uint32 itemid); + void DiscoverItem(uint32 itemid); - bool TGB() const { return tgb; } + bool TGB() const { return tgb; } - void OnDisconnect(bool hard_disconnect); + void OnDisconnect(bool hard_disconnect); - uint16 GetSkillPoints() { return m_pp.points;} - void SetSkillPoints(int inp) { m_pp.points = inp;} + uint16 GetSkillPoints() { return m_pp.points;} + void SetSkillPoints(int inp) { m_pp.points = inp;} - void IncreaseSkill(int skill_id, int value = 1) { if (skill_id <= HIGHEST_SKILL) { m_pp.skills[skill_id] += value; } } - void IncreaseLanguageSkill(int skill_id, int value = 1); + void IncreaseSkill(int skill_id, int value = 1) { if (skill_id <= HIGHEST_SKILL) { m_pp.skills[skill_id] += value; } } + void IncreaseLanguageSkill(int skill_id, int value = 1); virtual uint16 GetSkill(SkillUseTypes skill_id) const { if (skill_id <= HIGHEST_SKILL) { return((itembonuses.skillmod[skill_id] > 0) ? m_pp.skills[skill_id] * (100 + itembonuses.skillmod[skill_id]) / 100 : m_pp.skills[skill_id]); } return 0; } - uint32 GetRawSkill(SkillUseTypes skill_id) const { if (skill_id <= HIGHEST_SKILL) { return(m_pp.skills[skill_id]); } return 0; } - bool HasSkill(SkillUseTypes skill_id) const; - bool CanHaveSkill(SkillUseTypes skill_id) const; - void SetSkill(SkillUseTypes skill_num, uint16 value); - void AddSkill(SkillUseTypes skillid, uint16 value); - void CheckSpecializeIncrease(uint16 spell_id); - void CheckSongSkillIncrease(uint16 spell_id); - bool CheckIncreaseSkill(SkillUseTypes skillid, Mob *against_who, int chancemodi = 0); - void CheckLanguageSkillIncrease(uint8 langid, uint8 TeacherSkill); - void SetLanguageSkill(int langid, int value); - void SetHoTT(uint32 mobid); - void ShowSkillsWindow(); - void SendStatsWindow(Client* client, bool use_window); + uint32 GetRawSkill(SkillUseTypes skill_id) const { if (skill_id <= HIGHEST_SKILL) { return(m_pp.skills[skill_id]); } return 0; } + bool HasSkill(SkillUseTypes skill_id) const; + bool CanHaveSkill(SkillUseTypes skill_id) const; + void SetSkill(SkillUseTypes skill_num, uint16 value); + void AddSkill(SkillUseTypes skillid, uint16 value); + void CheckSpecializeIncrease(uint16 spell_id); + void CheckSongSkillIncrease(uint16 spell_id); + bool CheckIncreaseSkill(SkillUseTypes skillid, Mob *against_who, int chancemodi = 0); + void CheckLanguageSkillIncrease(uint8 langid, uint8 TeacherSkill); + void SetLanguageSkill(int langid, int value); + void SetHoTT(uint32 mobid); + void ShowSkillsWindow(); + void SendStatsWindow(Client* client, bool use_window); - uint16 MaxSkill(SkillUseTypes skillid, uint16 class_, uint16 level) const; - inline uint16 MaxSkill(SkillUseTypes skillid) const { return MaxSkill(skillid, GetClass(), GetLevel()); } - uint8 SkillTrainLevel(SkillUseTypes skillid, uint16 class_); + uint16 MaxSkill(SkillUseTypes skillid, uint16 class_, uint16 level) const; + inline uint16 MaxSkill(SkillUseTypes skillid) const { return MaxSkill(skillid, GetClass(), GetLevel()); } + uint8 SkillTrainLevel(SkillUseTypes skillid, uint16 class_); void TradeskillSearchResults(const std::string query, unsigned long objtype, unsigned long someid); void SendTradeskillDetails(uint32 recipe_id); @@ -692,11 +696,11 @@ public: void CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float skillup_modifier, uint16 success_modifier, SkillUseTypes tradeskill); void GMKill(); - inline bool IsMedding() const {return medding;} + inline bool IsMedding() const {return medding;} inline uint16 GetDuelTarget() const { return duel_target; } - inline bool IsDueling() const { return duelaccepted; } - inline void SetDuelTarget(uint16 set_id) { duel_target=set_id; } - inline void SetDueling(bool duel) { duelaccepted = duel; } + inline bool IsDueling() const { return duelaccepted; } + inline void SetDuelTarget(uint16 set_id) { duel_target=set_id; } + inline void SetDueling(bool duel) { duelaccepted = duel; } // use this one instead void MemSpell(uint16 spell_id, int slot, bool update_client = true); void UnmemSpell(int slot, bool update_client = true); @@ -709,11 +713,11 @@ public: bool SpellGlobalCheck(uint16 Spell_ID, uint16 Char_ID); uint32 GetCharMaxLevelFromQGlobal(); - inline bool IsSitting() const {return (playeraction == 1);} - inline bool IsBecomeNPC() const { return npcflag; } - inline uint8 GetBecomeNPCLevel() const { return npclevel; } - inline void SetBecomeNPC(bool flag) { npcflag = flag; } - inline void SetBecomeNPCLevel(uint8 level) { npclevel = level; } + inline bool IsSitting() const {return (playeraction == 1);} + inline bool IsBecomeNPC() const { return npcflag; } + inline uint8 GetBecomeNPCLevel() const { return npclevel; } + inline void SetBecomeNPC(bool flag) { npcflag = flag; } + inline void SetBecomeNPCLevel(uint8 level) { npclevel = level; } void SetFeigned(bool in_feigned); /// this cures timing issues cuz dead animation isn't done but server side feigning is? inline bool GetFeigned() const { return(feigned); } @@ -735,17 +739,17 @@ public: bool BindWound(Mob* bindmob, bool start, bool fail = false); void SetTradeskillObject(Object* object) { m_tradeskill_object = object; } Object* GetTradeskillObject() { return m_tradeskill_object; } - void SendTributes(); - void SendGuildTributes(); - void DoTributeUpdate(); - void SendTributeDetails(uint32 client_id, uint32 tribute_id); - int32 TributeItem(uint32 slot, uint32 quantity); - int32 TributeMoney(uint32 platinum); - void AddTributePoints(int32 ammount); - void ChangeTributeSettings(TributeInfo_Struct *t); - void SendTributeTimer(); - void ToggleTribute(bool enabled); - void SendPathPacket(std::vector &path); + void SendTributes(); + void SendGuildTributes(); + void DoTributeUpdate(); + void SendTributeDetails(uint32 client_id, uint32 tribute_id); + int32 TributeItem(uint32 slot, uint32 quantity); + int32 TributeMoney(uint32 platinum); + void AddTributePoints(int32 ammount); + void ChangeTributeSettings(TributeInfo_Struct *t); + void SendTributeTimer(); + void ToggleTribute(bool enabled); + void SendPathPacket(std::vector &path); inline PTimerList &GetPTimers() { return(p_timers); } @@ -757,9 +761,9 @@ public: void BuyAA(AA_Action* action); //this function is used by some AA stuff void MemorizeSpell(uint32 slot,uint32 spellid,uint32 scribing); - void SetAATitle(const char *Title); - void SetTitleSuffix(const char *txt); - inline uint32 GetMaxAAXP(void) const { return max_AAXP; } + void SetAATitle(const char *Title); + void SetTitleSuffix(const char *txt); + inline uint32 GetMaxAAXP(void) const { return max_AAXP; } inline uint32 GetAAXP() const { return m_pp.expAA; } void SendAAStats(); void SendAATable(); @@ -791,93 +795,93 @@ public: // Item methods void EVENT_ITEM_ScriptStopReturn(); - uint32 NukeItem(uint32 itemnum, uint8 where_to_check = + uint32 NukeItem(uint32 itemnum, uint8 where_to_check = (invWhereWorn | invWherePersonal | invWhereBank | invWhereSharedBank | invWhereTrading | invWhereCursor)); - void SetTint(int16 slot_id, uint32 color); - void SetTint(int16 slot_id, Color_Struct& color); - void SetMaterial(int16 slot_id, uint32 item_id); - void Undye(); - int32 GetItemIDAt(int16 slot_id); - int32 GetAugmentIDAt(int16 slot_id, uint8 augslot); - bool PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client_update = false); - bool PushItemOnCursor(const ItemInst& inst, bool client_update = false); - void DeleteItemInInventory(int16 slot_id, int8 quantity = 0, bool client_update = false, bool update_db = true); - bool SwapItem(MoveItem_Struct* move_in); - void SwapItemResync(MoveItem_Struct* move_slots); - void QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call = false); - void PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootItem_Struct** bag_item_data = 0); - bool AutoPutLootInInventory(ItemInst& inst, bool try_worn = false, bool try_cursor = true, ServerLootItem_Struct** bag_item_data = 0); - bool SummonItem(uint32 item_id, int16 charges = -1, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, bool attuned = false, uint16 to_slot = MainCursor); - void SetStats(uint8 type,int16 set_val); - void IncStats(uint8 type,int16 increase_val); - void DropItem(int16 slot_id); - bool MakeItemLink(char* &ret_link, const ItemInst* inst); - int GetItemLinkHash(const ItemInst* inst); - void SendItemLink(const ItemInst* inst, bool sendtoall=false); - void SendLootItemInPacket(const ItemInst* inst, int16 slot_id); - void SendItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType packet_type); - bool IsValidSlot(uint32 slot); - bool IsBankSlot(uint32 slot); + void SetTint(int16 slot_id, uint32 color); + void SetTint(int16 slot_id, Color_Struct& color); + void SetMaterial(int16 slot_id, uint32 item_id); + void Undye(); + int32 GetItemIDAt(int16 slot_id); + int32 GetAugmentIDAt(int16 slot_id, uint8 augslot); + bool PutItemInInventory(int16 slot_id, const ItemInst& inst, bool client_update = false); + bool PushItemOnCursor(const ItemInst& inst, bool client_update = false); + void DeleteItemInInventory(int16 slot_id, int8 quantity = 0, bool client_update = false, bool update_db = true); + bool SwapItem(MoveItem_Struct* move_in); + void SwapItemResync(MoveItem_Struct* move_slots); + void QSSwapItemAuditor(MoveItem_Struct* move_in, bool postaction_call = false); + void PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootItem_Struct** bag_item_data = 0); + bool AutoPutLootInInventory(ItemInst& inst, bool try_worn = false, bool try_cursor = true, ServerLootItem_Struct** bag_item_data = 0); + bool SummonItem(uint32 item_id, int16 charges = -1, uint32 aug1 = 0, uint32 aug2 = 0, uint32 aug3 = 0, uint32 aug4 = 0, uint32 aug5 = 0, bool attuned = false, uint16 to_slot = MainCursor); + void SetStats(uint8 type,int16 set_val); + void IncStats(uint8 type,int16 increase_val); + void DropItem(int16 slot_id); + bool MakeItemLink(char* &ret_link, const ItemInst* inst); + int GetItemLinkHash(const ItemInst* inst); + void SendItemLink(const ItemInst* inst, bool sendtoall=false); + void SendLootItemInPacket(const ItemInst* inst, int16 slot_id); + void SendItemPacket(int16 slot_id, const ItemInst* inst, ItemPacketType packet_type); + bool IsValidSlot(uint32 slot); + bool IsBankSlot(uint32 slot); - inline bool IsTrader() const { return(Trader); } - inline bool IsBuyer() const { return(Buyer); } - eqFilterMode GetFilter(eqFilterType filter_id) const { return ClientFilters[filter_id]; } - void SetFilter(eqFilterType filter_id, eqFilterMode value) { ClientFilters[filter_id]=value; } + inline bool IsTrader() const { return(Trader); } + inline bool IsBuyer() const { return(Buyer); } + eqFilterMode GetFilter(eqFilterType filter_id) const { return ClientFilters[filter_id]; } + void SetFilter(eqFilterType filter_id, eqFilterMode value) { ClientFilters[filter_id]=value; } - void BreakInvis(); - void LeaveGroup(); + void BreakInvis(); + void LeaveGroup(); - bool Hungry() const {if (GetGM()) return false; return m_pp.hunger_level <= 3000;} - bool Thirsty() const {if (GetGM()) return false; return m_pp.thirst_level <= 3000;} -int32 GetHunger() const { return m_pp.hunger_level; } -int32 GetThirst() const { return m_pp.thirst_level; } -void SetHunger(int32 in_hunger); -void SetThirst(int32 in_thirst); -void SetConsumption(int32 in_hunger, int32 in_thirst); + bool Hungry() const {if (GetGM()) return false; return m_pp.hunger_level <= 3000;} + bool Thirsty() const {if (GetGM()) return false; return m_pp.thirst_level <= 3000;} +int32 GetHunger() const { return m_pp.hunger_level; } +int32 GetThirst() const { return m_pp.thirst_level; } +void SetHunger(int32 in_hunger); +void SetThirst(int32 in_thirst); +void SetConsumption(int32 in_hunger, int32 in_thirst); - bool CheckTradeLoreConflict(Client* other); - void LinkDead(); - void Insight(uint32 t_id); - bool CheckDoubleAttack(bool tripleAttack = false); - bool CheckDoubleRangedAttack(); + bool CheckTradeLoreConflict(Client* other); + void LinkDead(); + void Insight(uint32 t_id); + bool CheckDoubleAttack(bool tripleAttack = false); + bool CheckDoubleRangedAttack(); //remove charges/multiple objects from inventory: - //bool DecreaseByType(uint32 type, uint8 amt); - bool DecreaseByID(uint32 type, uint8 amt); - uint8 SlotConvert2(uint8 slot); //Maybe not needed. - void Escape(); //AA Escape - void RemoveNoRent(bool client_update = true); - void RemoveDuplicateLore(bool client_update = true); - void MoveSlotNotAllowed(bool client_update = true); - virtual void RangedAttack(Mob* other, bool CanDoubleAttack = false); - virtual void ThrowingAttack(Mob* other, bool CanDoubleAttack = false); - void DoClassAttacks(Mob *ca_target, uint16 skill = -1, bool IsRiposte=false); + //bool DecreaseByType(uint32 type, uint8 amt); + bool DecreaseByID(uint32 type, uint8 amt); + uint8 SlotConvert2(uint8 slot); //Maybe not needed. + void Escape(); //AA Escape + void RemoveNoRent(bool client_update = true); + void RemoveDuplicateLore(bool client_update = true); + void MoveSlotNotAllowed(bool client_update = true); + virtual void RangedAttack(Mob* other, bool CanDoubleAttack = false); + virtual void ThrowingAttack(Mob* other, bool CanDoubleAttack = false); + void DoClassAttacks(Mob *ca_target, uint16 skill = -1, bool IsRiposte=false); - void SetZoneFlag(uint32 zone_id); - void ClearZoneFlag(uint32 zone_id); - bool HasZoneFlag(uint32 zone_id) const; - void SendZoneFlagInfo(Client *to) const; - void LoadZoneFlags(); + void SetZoneFlag(uint32 zone_id); + void ClearZoneFlag(uint32 zone_id); + bool HasZoneFlag(uint32 zone_id) const; + void SendZoneFlagInfo(Client *to) const; + void LoadZoneFlags(); - void ChangeSQLLog(const char *file); - void LogSQL(const char *fmt, ...); - bool CanFish(); - void GoFish(); - void ForageItem(bool guarantee = false); + void ChangeSQLLog(const char *file); + void LogSQL(const char *fmt, ...); + bool CanFish(); + void GoFish(); + void ForageItem(bool guarantee = false); //Calculate vendor price modifier based on CHA: (reverse==selling) - float CalcPriceMod(Mob* other = 0, bool reverse = false); - void ResetTrade(); - void DropInst(const ItemInst* inst); - bool TrainDiscipline(uint32 itemid); - void SendDisciplineUpdate(); - bool UseDiscipline(uint32 spell_id, uint32 target); + float CalcPriceMod(Mob* other = 0, bool reverse = false); + void ResetTrade(); + void DropInst(const ItemInst* inst); + bool TrainDiscipline(uint32 itemid); + void SendDisciplineUpdate(); + bool UseDiscipline(uint32 spell_id, uint32 target); - bool CheckTitle(int titleset); - void EnableTitle(int titleset); - void RemoveTitle(int titleset); + bool CheckTitle(int titleset); + void EnableTitle(int titleset); + void RemoveTitle(int titleset); - void EnteringMessages(Client* client); - void SendRules(Client* client); + void EnteringMessages(Client* client); + void SendRules(Client* client); std::list consent_list; //Anti-Cheat Stuff @@ -904,97 +908,63 @@ void SetConsumption(int32 in_hunger, int32 in_thirst); void SendBuffDurationPacket(Buffs_Struct &buff); void SendBuffNumHitPacket(Buffs_Struct &buff, int slot); - void ProcessInspectRequest(Client* requestee, Client* requester); - bool ClientFinishedLoading() { return (conn_state == ClientConnectFinished); } - int FindSpellBookSlotBySpellID(uint16 spellid); - int GetNextAvailableSpellBookSlot(int starting_slot = 0); + void ProcessInspectRequest(Client* requestee, Client* requester); + bool ClientFinishedLoading() { return (conn_state == ClientConnectFinished); } + int FindSpellBookSlotBySpellID(uint16 spellid); + int GetNextAvailableSpellBookSlot(int starting_slot = 0); inline uint32 GetSpellByBookSlot(int book_slot) { return m_pp.spell_book[book_slot]; } inline bool HasSpellScribed(int spellid) { return (FindSpellBookSlotBySpellID(spellid) != -1 ? true : false); } - uint16 GetMaxSkillAfterSpecializationRules(SkillUseTypes skillid, uint16 maxSkill); - void SendPopupToClient(const char *Title, const char *Text, uint32 PopupID = 0, uint32 Buttons = 0, uint32 Duration = 0); - void SendWindow(uint32 PopupID, uint32 NegativeID, uint32 Buttons, const char *ButtonName0, const char *ButtonName1, uint32 Duration, int title_type, Client* target, const char *Title, const char *Text, ...); - bool PendingTranslocate; - time_t TranslocateTime; - bool PendingSacrifice; - std::string SacrificeCaster; - struct Translocate_Struct PendingTranslocateData; - void SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID); + uint16 GetMaxSkillAfterSpecializationRules(SkillUseTypes skillid, uint16 maxSkill); + void SendPopupToClient(const char *Title, const char *Text, uint32 PopupID = 0, uint32 Buttons = 0, uint32 Duration = 0); + void SendWindow(uint32 PopupID, uint32 NegativeID, uint32 Buttons, const char *ButtonName0, const char *ButtonName1, uint32 Duration, int title_type, Client* target, const char *Title, const char *Text, ...); + bool PendingTranslocate; + time_t TranslocateTime; + bool PendingSacrifice; + std::string SacrificeCaster; + PendingTranslocate_Struct PendingTranslocateData; + void SendOPTranslocateConfirm(Mob *Caster, uint16 SpellID); // Task System Methods - void LoadClientTaskState(); - void RemoveClientTaskState(); - void SendTaskActivityComplete(int TaskID, int ActivityID, int TaskIndex, int TaskIncomplete=1); - void SendTaskFailed(int TaskID, int TaskIndex); - void SendTaskComplete(int TaskIndex); + void LoadClientTaskState(); + void RemoveClientTaskState(); + void SendTaskActivityComplete(int TaskID, int ActivityID, int TaskIndex, int TaskIncomplete=1); + void SendTaskFailed(int TaskID, int TaskIndex); + void SendTaskComplete(int TaskIndex); inline void CancelTask(int TaskIndex) { if(taskstate) taskstate->CancelTask(this, TaskIndex); } - inline bool SaveTaskState() { return (taskmanager ? taskmanager->SaveClientState(this, taskstate) : false); } - inline bool IsTaskStateLoaded() { return taskstate != nullptr; } - inline bool IsTaskActive(int TaskID) { return (taskstate ? taskstate->IsTaskActive(TaskID) : false); } - inline bool IsTaskActivityActive(int TaskID, int ActivityID) { return (taskstate ? taskstate->IsTaskActivityActive(TaskID, ActivityID) : false); } - inline ActivityState GetTaskActivityState(int index, int ActivityID) { return (taskstate ? taskstate->GetTaskActivityState(index, ActivityID) : ActivityHidden); } - inline void UpdateTaskActivity(int TaskID, int ActivityID, int Count) { if(taskstate) taskstate->UpdateTaskActivity(this, TaskID, ActivityID, Count); } - inline void ResetTaskActivity(int TaskID, int ActivityID) { if(taskstate) taskstate->ResetTaskActivity(this, TaskID, ActivityID); } - inline void UpdateTasksOnKill(int NPCTypeID) { if(taskstate) taskstate->UpdateTasksOnKill(this, NPCTypeID); } - inline void UpdateTasksForItem(ActivityType Type, int ItemID, int Count=1) { if(taskstate) taskstate->UpdateTasksForItem(this, Type, ItemID, Count); } - inline void UpdateTasksOnExplore(int ExploreID) { if(taskstate) taskstate->UpdateTasksOnExplore(this, ExploreID); } - inline bool UpdateTasksOnSpeakWith(int NPCTypeID) { if(taskstate) return taskstate->UpdateTasksOnSpeakWith(this, NPCTypeID); else return false; } - inline bool UpdateTasksOnDeliver(uint32 *Items, int Cash, int NPCTypeID) { if(taskstate) return taskstate->UpdateTasksOnDeliver(this, Items, Cash, NPCTypeID); else return false; } - inline void TaskSetSelector(Mob *mob, int TaskSetID) { if(taskmanager) taskmanager->TaskSetSelector(this, taskstate, mob, TaskSetID); } - inline void EnableTask(int TaskCount, int *TaskList) { if(taskstate) taskstate->EnableTask(CharacterID(), TaskCount, TaskList); } - inline void DisableTask(int TaskCount, int *TaskList) { if(taskstate) taskstate->DisableTask(CharacterID(), TaskCount, TaskList); } - inline bool IsTaskEnabled(int TaskID) { return (taskstate ? taskstate->IsTaskEnabled(TaskID) : false); } - inline void ProcessTaskProximities(float X, float Y, float Z) { if(taskstate) taskstate->ProcessTaskProximities(this, X, Y, Z); } - inline void AssignTask(int TaskID, int NPCID) { if(taskstate) taskstate->AcceptNewTask(this, TaskID, NPCID); } - inline int ActiveSpeakTask(int NPCID) { if(taskstate) return taskstate->ActiveSpeakTask(NPCID); else return 0; } - inline int ActiveSpeakActivity(int NPCID, int TaskID) { if(taskstate) return taskstate->ActiveSpeakActivity(NPCID, TaskID); else return 0; } - inline void FailTask(int TaskID) { if(taskstate) taskstate->FailTask(this, TaskID); } - inline int TaskTimeLeft(int TaskID) { return (taskstate ? taskstate->TaskTimeLeft(TaskID) : 0); } - inline int EnabledTaskCount(int TaskSetID) { return (taskstate ? taskstate->EnabledTaskCount(TaskSetID) : -1); } - inline int IsTaskCompleted(int TaskID) { return (taskstate ? taskstate->IsTaskCompleted(TaskID) : -1); } - inline void ShowClientTasks() { if(taskstate) taskstate->ShowClientTasks(this); } - inline void CancelAllTasks() { if(taskstate) taskstate->CancelAllTasks(this); } - inline int GetActiveTaskCount() { return (taskstate ? taskstate->GetActiveTaskCount() : 0); } - inline int GetActiveTaskID(int index) { return (taskstate ? taskstate->GetActiveTaskID(index) : -1); } - inline int GetTaskStartTime(int index) { return (taskstate ? taskstate->GetTaskStartTime(index) : -1); } - inline bool IsTaskActivityCompleted(int index, int ActivityID) { return (taskstate ? taskstate->IsTaskActivityCompleted(index, ActivityID) : false); } - inline int GetTaskActivityDoneCount(int ClientTaskIndex, int ActivityID) { return (taskstate ? taskstate->GetTaskActivityDoneCount(ClientTaskIndex, ActivityID) :0); } - inline int GetTaskActivityDoneCountFromTaskID(int TaskID, int ActivityID) { return (taskstate ? taskstate->GetTaskActivityDoneCountFromTaskID(TaskID, ActivityID) :0); } - inline int ActiveTasksInSet(int TaskSet) { return (taskstate ? taskstate->ActiveTasksInSet(TaskSet) :0); } - inline int CompletedTasksInSet(int TaskSet) { return (taskstate ? taskstate->CompletedTasksInSet(TaskSet) :0); } inline const EQClientVersion GetClientVersion() const { return ClientVersion; } @@ -1047,7 +1017,7 @@ void SetConsumption(int32 in_hunger, int32 in_thirst); void HandleLDoNSenseTraps(NPC *target, uint16 skill, uint8 type); void HandleLDoNDisarm(NPC *target, uint16 skill, uint8 type); void HandleLDoNPickLock(NPC *target, uint16 skill, uint8 type); - int LDoNChest_SkillCheck(NPC *target, int skill); + int LDoNChest_SkillCheck(NPC *target, int skill); void MarkSingleCompassLoc(float in_x, float in_y, float in_z, uint8 count=1); @@ -1087,11 +1057,11 @@ void SetConsumption(int32 in_hunger, int32 in_thirst); inline bool GetPendingGuildInvitation() { return PendingGuildInvitation; } void LocateCorpse(); void SendTargetCommand(uint32 EntityID); - bool MoveItemToInventory(ItemInst *BInst, bool UpdateClient = false); + bool MoveItemToInventory(ItemInst *BInst, bool UpdateClient = false); void HandleRespawnFromHover(uint32 Option); bool IsHoveringForRespawn() { return RespawnFromHoverTimer.Enabled(); } std::list respawn_options; - void AddRespawnOption(std::string option_name, uint32 zoneid, float x, float y, float z, float h = 0, bool initial_selection = false, int8 position = -1); + void AddRespawnOption(std::string option_name, uint32 zoneid, uint16 instance_id, float x, float y, float z, float h = 0, bool initial_selection = false, int8 position = -1); bool RemoveRespawnOption(std::string option_name); bool RemoveRespawnOption(uint8 position); void ClearRespawnOptions() { respawn_options.clear(); } @@ -1134,8 +1104,8 @@ void SetConsumption(int32 in_hunger, int32 in_thirst); bool CheckCanRetainMerc(uint32 upkeep); bool CheckCanUnsuspendMerc(); bool CheckCanDismissMerc(); - inline uint32 GetMercID() const { return mercid; } - inline uint8 GetMercSlot() const { return mercSlot; } + inline uint32 GetMercID() const { return mercid; } + inline uint8 GetMercSlot() const { return mercSlot; } void SetMercID( uint32 newmercid) { mercid = newmercid; } void SetMercSlot( uint8 newmercslot) { mercSlot = newmercslot; } Merc* GetMerc(); @@ -1184,7 +1154,7 @@ void SetConsumption(int32 in_hunger, int32 in_thirst); int32 GetActCHA() { return( std::min(GetMaxCHA(), GetCHA()) ); } void LoadAccountFlags(); void SetAccountFlag(std::string flag, std::string val); - std::string GetAccountFlag(std::string flag); float GetDamageMultiplier(SkillUseTypes); + std::string GetAccountFlag(std::string flag); float GetDamageMultiplier(SkillUseTypes); void Consume(const Item_Struct *item, uint8 type, int16 slot, bool auto_consume); void PlayMP3(const char* fname); void ExpeditionSay(const char *str, int ExpID); @@ -1232,10 +1202,10 @@ protected: void MakeBuffFadePacket(uint16 spell_id, int slot_id, bool send_message = true); bool client_data_loaded; - int16 GetFocusEffect(focusType type, uint16 spell_id); - int16 GetSympatheticFocusEffect(focusType type, uint16 spell_id); + int16 GetFocusEffect(focusType type, uint16 spell_id); + int16 GetSympatheticFocusEffect(focusType type, uint16 spell_id); - Mob* bind_sight_target; + Mob* bind_sight_target; Map::Vertex aa_los_me; Map::Vertex aa_los_them; @@ -1260,52 +1230,52 @@ protected: private: eqFilterMode ClientFilters[_FilterCount]; - int32 HandlePacket(const EQApplicationPacket *app); - void OPTGB(const EQApplicationPacket *app); - void OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 InstanceID, float x, float y, float z); - void OPMemorizeSpell(const EQApplicationPacket *app); - void OPMoveCoin(const EQApplicationPacket* app); - void MoveItemCharges(ItemInst &from, int16 to_slot, uint8 type); - void OPGMTraining(const EQApplicationPacket *app); - void OPGMEndTraining(const EQApplicationPacket *app); - void OPGMTrainSkill(const EQApplicationPacket *app); - void OPGMSummon(const EQApplicationPacket *app); - void OPCombatAbility(const EQApplicationPacket *app); + int32 HandlePacket(const EQApplicationPacket *app); + void OPTGB(const EQApplicationPacket *app); + void OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 InstanceID, float x, float y, float z); + void OPMemorizeSpell(const EQApplicationPacket *app); + void OPMoveCoin(const EQApplicationPacket* app); + void MoveItemCharges(ItemInst &from, int16 to_slot, uint8 type); + void OPGMTraining(const EQApplicationPacket *app); + void OPGMEndTraining(const EQApplicationPacket *app); + void OPGMTrainSkill(const EQApplicationPacket *app); + void OPGMSummon(const EQApplicationPacket *app); + void OPCombatAbility(const EQApplicationPacket *app); // Bandolier Methods - void CreateBandolier(const EQApplicationPacket *app); - void RemoveBandolier(const EQApplicationPacket *app); - void SetBandolier(const EQApplicationPacket *app); + void CreateBandolier(const EQApplicationPacket *app); + void RemoveBandolier(const EQApplicationPacket *app); + void SetBandolier(const EQApplicationPacket *app); - void HandleTraderPriceUpdate(const EQApplicationPacket *app); + void HandleTraderPriceUpdate(const EQApplicationPacket *app); - int32 CalcAC(); - int32 GetACMit(); - int32 GetACAvoid(); - int32 CalcATK(); - int32 CalcHaste(); + int32 CalcAC(); + int32 GetACMit(); + int32 GetACAvoid(); + int32 CalcATK(); + int32 CalcHaste(); - int32 CalcAlcoholPhysicalEffect(); - int32 CalcSTR(); - int32 CalcSTA(); - int32 CalcDEX(); - int32 CalcAGI(); - int32 CalcINT(); - int32 CalcWIS(); - int32 CalcCHA(); + int32 CalcAlcoholPhysicalEffect(); + int32 CalcSTR(); + int32 CalcSTA(); + int32 CalcDEX(); + int32 CalcAGI(); + int32 CalcINT(); + int32 CalcWIS(); + int32 CalcCHA(); - int32 CalcMR(); - int32 CalcFR(); - int32 CalcDR(); - int32 CalcPR(); - int32 CalcCR(); - int32 CalcCorrup(); - int32 CalcMaxHP(); - int32 CalcBaseHP(); - int32 CalcHPRegen(); - int32 CalcManaRegen(); - int32 CalcBaseManaRegen(); - uint32 GetClassHPFactor(); + int32 CalcMR(); + int32 CalcFR(); + int32 CalcDR(); + int32 CalcPR(); + int32 CalcCR(); + int32 CalcCorrup(); + int32 CalcMaxHP(); + int32 CalcBaseHP(); + int32 CalcHPRegen(); + int32 CalcManaRegen(); + int32 CalcBaseManaRegen(); + uint32 GetClassHPFactor(); void DoHPRegen(); void DoManaRegen(); void DoStaminaUpdate(); @@ -1317,75 +1287,75 @@ private: EQStreamInterface* eqs; - uint32 ip; - uint16 port; - CLIENT_CONN_STATUS client_state; - uint32 character_id; - uint32 WID; - uint32 account_id; - char account_name[30]; - uint32 lsaccountid; - char lskey[30]; - int16 admin; - uint32 guild_id; - uint8 guildrank; // player's rank in the guild, 0-GUILD_MAX_RANK - bool GuildBanker; - uint16 duel_target; - bool duelaccepted; + uint32 ip; + uint16 port; + CLIENT_CONN_STATUS client_state; + uint32 character_id; + uint32 WID; + uint32 account_id; + char account_name[30]; + uint32 lsaccountid; + char lskey[30]; + int16 admin; + uint32 guild_id; + uint8 guildrank; // player's rank in the guild, 0-GUILD_MAX_RANK + bool GuildBanker; + uint16 duel_target; + bool duelaccepted; std::list keyring; - bool tellsoff; // GM /toggle - bool gmhideme; - bool LFG; - bool LFP; - uint8 LFGFromLevel; - uint8 LFGToLevel; - bool LFGMatchFilter; - char LFGComments[64]; - bool AFK; - bool auto_attack; - bool auto_fire; - uint8 gmspeed; - bool medding; - uint16 horseId; - bool revoked; - uint32 pQueuedSaveWorkID; - uint16 pClientSideTarget; - uint32 weight; - bool berserk; - bool dead; - uint16 BoatID; - uint16 TrackingID; - uint16 CustomerID; - uint32 account_creation; - uint8 firstlogon; - uint32 mercid; // current merc - uint8 mercSlot; // selected merc slot - bool Trader; - bool Buyer; - std::string BuyerWelcomeMessage; - bool AbilityTimer; + bool tellsoff; // GM /toggle + bool gmhideme; + bool LFG; + bool LFP; + uint8 LFGFromLevel; + uint8 LFGToLevel; + bool LFGMatchFilter; + char LFGComments[64]; + bool AFK; + bool auto_attack; + bool auto_fire; + uint8 gmspeed; + bool medding; + uint16 horseId; + bool revoked; + uint32 pQueuedSaveWorkID; + uint16 pClientSideTarget; + uint32 weight; + bool berserk; + bool dead; + uint16 BoatID; + uint16 TrackingID; + uint16 CustomerID; + uint32 account_creation; + uint8 firstlogon; + uint32 mercid; // current merc + uint8 mercSlot; // selected merc slot + bool Trader; + bool Buyer; + std::string BuyerWelcomeMessage; + bool AbilityTimer; int Haste; //precalced value - int32 max_end; - int32 cur_end; + int32 max_end; + int32 cur_end; - PlayerProfile_Struct m_pp; - ExtendedProfile_Struct m_epp; - Inventory m_inv; - Object* m_tradeskill_object; - PetInfo m_petinfo; // current pet data, used while loading from and saving to DB - PetInfo m_suspendedminion; // pet data for our suspended minion. - MercInfo m_mercinfo[MAXMERCS]; // current mercenary - InspectMessage_Struct m_inspect_message; + PlayerProfile_Struct m_pp; + ExtendedProfile_Struct m_epp; + Inventory m_inv; + Object* m_tradeskill_object; + PetInfo m_petinfo; // current pet data, used while loading from and saving to DB + PetInfo m_suspendedminion; // pet data for our suspended minion. + MercInfo m_mercinfo[MAXMERCS]; // current mercenary + InspectMessage_Struct m_inspect_message; void NPCSpawn(const Seperator* sep); uint32 GetEXPForLevel(uint16 level); - bool CanBeInZone(); - void SendLogoutPackets(); - bool AddPacket(const EQApplicationPacket *, bool); - bool AddPacket(EQApplicationPacket**, bool); - bool SendAllPackets(); + bool CanBeInZone(); + void SendLogoutPackets(); + bool AddPacket(const EQApplicationPacket *, bool); + bool AddPacket(EQApplicationPacket**, bool); + bool SendAllPackets(); LinkedList clientpackets; //Zoning related stuff @@ -1394,62 +1364,62 @@ private: void DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instance_id, float dest_x, float dest_y, float dest_z, float dest_h, int8 ignore_r); void ZonePC(uint32 zoneID, uint32 instance_id, float x, float y, float z, float heading, uint8 ignorerestrictions, ZoneMode zm); void ProcessMovePC(uint32 zoneID, uint32 instance_id, float x, float y, float z, float heading, uint8 ignorerestrictions = 0, ZoneMode zm = ZoneSolicited); - float zonesummon_x; - float zonesummon_y; - float zonesummon_z; - uint16 zonesummon_id; - uint8 zonesummon_ignorerestrictions; + float zonesummon_x; + float zonesummon_y; + float zonesummon_z; + uint16 zonesummon_id; + uint8 zonesummon_ignorerestrictions; ZoneMode zone_mode; - Timer position_timer; - uint8 position_timer_counter; + Timer position_timer; + uint8 position_timer_counter; - PTimerList p_timers; //persistent timers - Timer hpupdate_timer; - Timer camp_timer; - Timer process_timer; - Timer stamina_timer; - Timer zoneinpacket_timer; - Timer linkdead_timer; - Timer dead_timer; - Timer global_channel_timer; - Timer shield_timer; - Timer fishing_timer; - Timer endupkeep_timer; - Timer forget_timer; // our 2 min everybody forgets you timer - Timer autosave_timer; + PTimerList p_timers; //persistent timers + Timer hpupdate_timer; + Timer camp_timer; + Timer process_timer; + Timer stamina_timer; + Timer zoneinpacket_timer; + Timer linkdead_timer; + Timer dead_timer; + Timer global_channel_timer; + Timer shield_timer; + Timer fishing_timer; + Timer endupkeep_timer; + Timer forget_timer; // our 2 min everybody forgets you timer + Timer autosave_timer; #ifdef REVERSE_AGGRO - Timer scanarea_timer; + Timer scanarea_timer; #endif - Timer tribute_timer; + Timer tribute_timer; - Timer proximity_timer; - Timer TaskPeriodic_Timer; - Timer charm_update_timer; - Timer rest_timer; - Timer charm_class_attacks_timer; - Timer charm_cast_timer; - Timer qglobal_purge_timer; - Timer TrackingTimer; - Timer RespawnFromHoverTimer; - Timer merc_timer; + Timer proximity_timer; + Timer TaskPeriodic_Timer; + Timer charm_update_timer; + Timer rest_timer; + Timer charm_class_attacks_timer; + Timer charm_cast_timer; + Timer qglobal_purge_timer; + Timer TrackingTimer; + Timer RespawnFromHoverTimer; + Timer merc_timer; - float proximity_x; - float proximity_y; - float proximity_z; + float proximity_x; + float proximity_y; + float proximity_z; - void BulkSendInventoryItems(); + void BulkSendInventoryItems(); faction_map factionvalues; uint32 tribute_master_id; FILE *SQL_log; - uint32 max_AAXP; - uint32 staminacount; - AA_Array* aa[MAX_PP_AA_ARRAY]; //this list contains pointers into our player profile + uint32 max_AAXP; + uint32 staminacount; + AA_Array* aa[MAX_PP_AA_ARRAY]; //this list contains pointers into our player profile std::map aa_points; bool npcflag; uint8 npclevel; @@ -1457,14 +1427,14 @@ private: bool zoning; bool tgb; bool instalog; - int32 last_reported_mana; - int32 last_reported_endur; + int32 last_reported_mana; + int32 last_reported_endur; unsigned int AggroCount; // How many mobs are aggro on us. - unsigned int RestRegenHP; - unsigned int RestRegenMana; - unsigned int RestRegenEndurance; + unsigned int RestRegenHP; + unsigned int RestRegenMana; + unsigned int RestRegenEndurance; bool EngagedRaidTarget; uint32 SavedRaidRestTimer; @@ -1482,7 +1452,7 @@ private: uint32 AttemptedMessages; EQClientVersion ClientVersion; - uint32 ClientVersionBit; + uint32 ClientVersionBit; int XPRate; @@ -1497,18 +1467,18 @@ private: //Connecting debug code. enum { //connecting states, used for debugging only - NoPacketsReceived, //havent gotten anything + NoPacketsReceived, //havent gotten anything //this is the point where the client changes to the loading screen - ReceivedZoneEntry, //got the first packet, loading up PP - PlayerProfileLoaded, //our DB work is done, sending it - ZoneInfoSent, //includes PP, tributes, tasks, spawns, time and weather + ReceivedZoneEntry, //got the first packet, loading up PP + PlayerProfileLoaded, //our DB work is done, sending it + ZoneInfoSent, //includes PP, tributes, tasks, spawns, time and weather //this is the point where the client shows a status bar zoning in - NewZoneRequested, //received and sent new zone request - ClientSpawnRequested, //client sent ReqClientSpawn - ZoneContentsSent, //objects, doors, zone points - ClientReadyReceived, //client told us its ready, send them a bunch of crap like guild MOTD, etc + NewZoneRequested, //received and sent new zone request + ClientSpawnRequested, //client sent ReqClientSpawn + ZoneContentsSent, //objects, doors, zone points + ClientReadyReceived, //client told us its ready, send them a bunch of crap like guild MOTD, etc //this is the point where the client releases the mouse - ClientConnectFinished //client finally moved to finished state, were done here + ClientConnectFinished //client finally moved to finished state, were done here } conn_state; void ReportConnectingState(); @@ -1516,8 +1486,8 @@ private: bool PendingGuildInvitation; int PendingRezzXP; uint32 PendingRezzDBID; - uint16 PendingRezzSpellID; // Only used for resurrect while hovering. - std::string PendingRezzCorpseName; // Only used for resurrect while hovering. + uint16 PendingRezzSpellID; // Only used for resurrect while hovering. + std::string PendingRezzCorpseName; // Only used for resurrect while hovering. std::set PlayerBlockedBuffs; std::set PetBlockedBuffs; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 15c4f3497..941eaf774 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -13725,7 +13725,8 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) } Translocate_Struct *its = (Translocate_Struct*)app->pBuffer; - if (!PendingTranslocate) return; + if (!PendingTranslocate) + return; if ((RuleI(Spells, TranslocateTimeLimit) > 0) && (time(nullptr) > (TranslocateTime + RuleI(Spells, TranslocateTimeLimit)))) { Message(13, "You did not accept the Translocate within the required time limit."); @@ -13735,7 +13736,7 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) if (its->Complete == 1) { - int SpellID = PendingTranslocateData.SpellID; + int SpellID = PendingTranslocateData.spell_id; int i = parse->EventSpell(EVENT_SPELL_EFFECT_TRANSLOCATE_COMPLETE, nullptr, this, SpellID, 0); if (i == 0) @@ -13745,20 +13746,19 @@ void Client::Handle_OP_Translocate(const EQApplicationPacket *app) // to the bind coords it has from the PlayerProfile, but with the X and Y reversed. I suspect they are // reversed in the pp, and since spells like Gate are handled serverside, this has not mattered before. if (((SpellID == 1422) || (SpellID == 1334) || (SpellID == 3243)) && - zone->GetZoneID() == PendingTranslocateData.ZoneID) + (zone->GetZoneID() == PendingTranslocateData.zone_id && + zone->GetInstanceID() == PendingTranslocateData.instance_id)) { PendingTranslocate = false; GoToBind(); return; } - EQApplicationPacket* outapp = new EQApplicationPacket(OP_Translocate, sizeof(Translocate_Struct)); - Translocate_Struct *ots = (Translocate_Struct*)outapp->pBuffer; - memcpy(ots, &PendingTranslocateData, sizeof(Translocate_Struct)); - - //Was sending the packet back to initiate client zone... - //but that could be abusable, so lets go through proper channels - MovePC(ots->ZoneID, 0, ots->x, ots->y, ots->z, GetHeading(), 0, ZoneSolicited); + ////Was sending the packet back to initiate client zone... + ////but that could be abusable, so lets go through proper channels + MovePC(PendingTranslocateData.zone_id, PendingTranslocateData.instance_id, + PendingTranslocateData.x, PendingTranslocateData.y, + PendingTranslocateData.z, PendingTranslocateData.heading, 0, ZoneSolicited); } } diff --git a/zone/client_process.cpp b/zone/client_process.cpp index e26dcd2e3..2f46a5688 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -147,11 +147,11 @@ bool Client::Process() { if(mana_timer.Check()) SendManaUpdatePacket(); - if(dead && dead_timer.Check()) - { - database.MoveCharacterToZone(GetName(),database.GetZoneName(m_pp.binds[0].zoneId)); + if(dead && dead_timer.Check()) { + database.MoveCharacterToZone(GetName(), database.GetZoneName(m_pp.binds[0].zoneId)); + m_pp.zone_id = m_pp.binds[0].zoneId; - m_pp.zoneInstance = 0; + m_pp.zoneInstance = m_pp.binds[0].instance_id; m_pp.x = m_pp.binds[0].x; m_pp.y = m_pp.binds[0].y; m_pp.z = m_pp.binds[0].z; @@ -2120,7 +2120,8 @@ void Client::HandleRespawnFromHover(uint32 Option) BindStruct* b = &m_pp.binds[0]; default_to_bind = new RespawnOption; default_to_bind->name = "Bind Location"; - default_to_bind->zoneid = b->zoneId; + default_to_bind->zone_id = b->zoneId; + default_to_bind->instance_id = b->instance_id; default_to_bind->x = b->x; default_to_bind->y = b->y; default_to_bind->z = b->z; @@ -2129,7 +2130,7 @@ void Client::HandleRespawnFromHover(uint32 Option) is_rez = false; } - if (chosen->zoneid == zone->GetZoneID()) //If they should respawn in the current zone... + if (chosen->zone_id == zone->GetZoneID() && chosen->instance_id == zone->GetInstanceID()) //If they should respawn in the current zone... { if (is_rez) { @@ -2185,6 +2186,7 @@ void Client::HandleRespawnFromHover(uint32 Option) ZonePlayerToBind_Struct* gmg = (ZonePlayerToBind_Struct*) outapp->pBuffer; gmg->bind_zone_id = zone->GetZoneID(); + gmg->bind_instance_id = chosen->instance_id; gmg->x = chosen->x; gmg->y = chosen->y; gmg->z = chosen->z; @@ -2230,13 +2232,13 @@ void Client::HandleRespawnFromHover(uint32 Option) if(r) r->MemberZoned(this); - m_pp.zone_id = chosen->zoneid; - m_pp.zoneInstance = 0; - database.MoveCharacterToZone(this->CharacterID(), database.GetZoneName(chosen->zoneid)); + m_pp.zone_id = chosen->zone_id; + m_pp.zoneInstance = chosen->instance_id; + database.MoveCharacterToZone(CharacterID(), database.GetZoneName(chosen->zone_id)); Save(); - MovePC(chosen->zoneid,chosen->x,chosen->y,chosen->z,chosen->heading,1); + MovePC(chosen->zone_id, chosen->instance_id, chosen->x, chosen->y, chosen->z, chosen->heading, 1); } safe_delete(default_to_bind); diff --git a/zone/command.cpp b/zone/command.cpp index 31c679288..ce3d67fd6 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -150,31 +150,19 @@ int command_init(void) { if ( command_add("resetaa","- Resets a Player's AA in their profile and refunds spent AA's to unspent, disconnects player.",200,command_resetaa) || - command_add("qtest","- QueryServ testing command.",255,command_qtest) || command_add("bind","- Sets your targets bind spot to their current location",200,command_bind) || - command_add("sendop","[opcode] - LE's Private test command, leave it alone",200,command_sendop) || - command_add("optest","- solar's private test command",255,command_optest) || command_add("setstat","- Sets the stats to a specific value.",255,command_setstat) || command_add("incstat","- Increases or Decreases a client's stats permanently.",200,command_incstat) || command_add("help","[search term] - List available commands and their description, specify partial command as argument to search",0,command_help) || command_add("version","- Display current version of EQEmu server",0,command_version) || command_add("setfaction","[faction number] - Sets targeted NPC's faction in the database",170,command_setfaction) || - command_add("serversidename","- Prints target's server side name",0,command_serversidename) || - command_add("testspawn","[memloc] [value] - spawns a NPC for you only, with the specified values set in the spawn struct",200,command_testspawn) || - command_add("testspawnkill","- Sends an OP_Death packet for spawn made with #testspawn",200,command_testspawnkill) || command_add("wc","[wear slot] [material] - Sends an OP_WearChange for your target",200,command_wc) || - command_add("numauths","- TODO: describe this command",200,command_numauths) || command_add("setanim","[animnum] - Set target's appearance to animnum",200,command_setanim) || command_add("connectworldserver","- Make zone attempt to connect to worldserver",200,command_connectworldserver) || command_add("connectworld",nullptr,0,command_connectworldserver) || command_add("serverinfo","- Get OS info about server host",200,command_serverinfo) || - command_add("crashtest","- Crash the zoneserver",200,command_crashtest) || command_add("getvariable","[varname] - Get the value of a variable from the database",200,command_getvariable) || command_add("chat","[channel num] [message] - Send a channel message to all zones",200,command_chat) || - command_add("showpetspell","[spellid/searchstring] - search pet summoning spells",200,command_showpetspell) || - #ifdef IPC - command_add("ipc","- Toggle an NPC's interactive flag",200,command_ipc) || - #endif command_add("npcloot","[show/money/add/remove] [itemid/all/money: pp gp sp cp] - Manipulate the loot an NPC is carrying",80,command_npcloot) || command_add("log","- Search character event log",80,command_log) || command_add("gm","- Turn player target's or your GM flag on or off",80,command_gm) || @@ -182,7 +170,6 @@ int command_init(void) { command_add("zone","[zonename] [x] [y] [z] - Go to specified zone (coords optional)",50,command_zone) || command_add("zoneinstance","[instanceid] [x] [y] [z] - Go to specified instance zone (coords optional)",50,command_zone_instance) || command_add("peqzone","[zonename] - Go to specified zone, if you have > 75% health",0,command_peqzone) || - command_add("tgczone",nullptr,0,command_peqzone) || command_add("showbuffs","- List buffs active on your target or you if no target",50,command_showbuffs) || command_add("movechar","[charname] [zonename] - Move charname to zonename",50,command_movechar) || command_add("viewpetition","[petition number] - View a petition",20,command_viewpetition) || @@ -192,14 +179,12 @@ int command_init(void) { command_add("date","[yyyy] [mm] [dd] [HH] [MM] - Set EQ time",90,command_date) || command_add("time","[HH] [MM] - Set EQ time",90,command_time) || command_add("timezone","[HH] [MM] - Set timezone. Minutes are optional",90,command_timezone) || - command_add("synctod","- Send a time of day update to every client in zone",90,command_synctod) || command_add("invulnerable","[on/off] - Turn player target's or your invulnerable flag on or off",80,command_invul) || command_add("invul",nullptr,0,command_invul) || command_add("hideme","[on/off] - Hide yourself from spawn lists.",80,command_hideme) || command_add("gmhideme",nullptr,0,command_hideme) || command_add("emote","['name'/'world'/'zone'] [type] [message] - Send an emote message",80,command_emote) || command_add("fov","- Check wether you're behind or in your target's field of view",80,command_fov) || - command_add("manastat","- Report your or your target's cur/max mana",80,command_manastat) || command_add("npcstats","- Show stats about target NPC",80,command_npcstats) || command_add("zclip","[min] [max] - modifies and resends zhdr packet",80,command_zclip) || command_add("npccast","[targetname/entityid] [spellid] - Causes NPC target to cast spellid on targetname/entityid",80,command_npccast) || @@ -210,7 +195,6 @@ int command_init(void) { command_add("permagender","[gendernum] - Change your or your player target's gender (zone to take effect)",80,command_permagender) || command_add("weather","[0/1/2/3] (Off/Rain/Snow/Manual) - Change the weather",80,command_weather) || command_add("zheader","[zonename] - Load zheader for zonename from the database",80,command_zheader) || - command_add("zhdr",nullptr,0,command_zheader) || command_add("zsky","[skytype] - Change zone sky type",80,command_zsky) || command_add("zcolor","[red] [green] [blue] - Change sky color",80,command_zcolor) || command_add("zuwcoords","[z coord] - Set underworld coord",80,command_zuwcoords) || @@ -218,7 +202,6 @@ int command_init(void) { command_add("zunderworld","[zcoord] - Sets the underworld using zcoord",80,command_zunderworld) || command_add("spon","- Sends OP_MemorizeSpell",80,command_spon) || command_add("spoff","- Sends OP_ManaChange",80,command_spoff) || - command_add("itemtest","- merth's test function",250,command_itemtest) || command_add("gassign","[id] - Assign targetted NPC to predefined wandering grid id",100,command_gassign) || command_add("ai","[factionid/spellslist/con/guard/roambox/stop/start] - Modify AI on NPC target",100,command_ai) || command_add("showspellslist","Shows spell list of targeted NPC",100,command_showspellslist) || @@ -254,7 +237,7 @@ int command_init(void) { command_add("spawn","[name] [race] [level] [material] [hp] [gender] [class] [priweapon] [secweapon] [merchantid] - Spawn an NPC",10,command_spawn) || command_add("texture","[texture] [helmtexture] - Change your or your target's appearance, use 255 to show equipment",10,command_texture) || command_add("npctypespawn","[npctypeid] [factionid] - Spawn an NPC from the db",10,command_npctypespawn) || - command_add("dbspawn",nullptr,0,command_npctypespawn) || + command_add("dbspawn",nullptr,10,command_npctypespawn) || command_add("heal","- Completely heal your target",10,command_heal) || command_add("appearance","[type] [value] - Send an appearance packet for you or your target",150,command_appearance) || command_add("nukeitem","[itemid] - Remove itemid from your player target's inventory",150,command_nukeitem) || @@ -262,14 +245,12 @@ int command_init(void) { command_add("interrogateinv","- use [help] argument for available options",0,command_interrogateinv) || command_add("findnpctype","[search criteria] - Search database NPC types",100,command_findnpctype) || command_add("findzone","[search criteria] - Search database zones",100,command_findzone) || - command_add("fz",nullptr,100, command_findzone) || command_add("viewnpctype","[npctype id] - Show info about an npctype",100,command_viewnpctype) || command_add("reloadstatic","- Reload Static Zone Data",150,command_reloadstatic) || command_add("reloadquest"," - Clear quest cache (any argument causes it to also stop all timers)",150,command_reloadqst) || command_add("reloadqst"," - Clear quest cache (any argument causes it to also stop all timers)",150,command_reloadqst) || command_add("reloadworld",nullptr,255,command_reloadworld) || command_add("reloadlevelmods",nullptr,255,command_reloadlevelmods) || - command_add("rq",nullptr,0,command_reloadqst) || command_add("reloadzonepoints","- Reload zone points from database",150,command_reloadzps) || command_add("reloadzps",nullptr,0,command_reloadzps) || command_add("zoneshutdown","[shortname] - Shut down a zone server",150,command_zoneshutdown) || @@ -334,7 +315,6 @@ int command_init(void) { command_add("manaburn","- Use AA Wizard class skill manaburn on target",10,command_manaburn) || command_add("doanim","[animnum] [type] - Send an EmoteAnim for you or your target",50,command_doanim) || command_add("randomfeatures","- Temporarily randomizes the Facial Features of your target",80,command_randomfeatures) || - command_add("rf",nullptr,80,command_randomfeatures) || command_add("face","- Change the face of your target",80,command_face) || command_add("helm","- Change the helm of your target",80,command_helm) || command_add("hair","- Change the hair style of your target",80,command_hair) || @@ -349,7 +329,6 @@ int command_init(void) { command_add("scribespell", "[spellid] - Scribe specified spell in your target's spell book.", 180, command_scribespell) || command_add("unscribespell", "[spellid] - Unscribe specified spell from your target's spell book.", 180, command_unscribespell) || command_add("interrupt","[message id] [color] - Interrupt your casting. Arguments are optional.",50,command_interrupt) || - command_add("d1","[type] [spell] [damage] - Send an OP_Action packet with the specified values",200,command_d1) || command_add("summonitem","[itemid] [charges] - Summon an item onto your cursor. Charges are optional.",200,command_summonitem) || command_add("si",nullptr,200,command_summonitem) || command_add("giveitem","[itemid] [charges] - Summon an item onto your target's cursor. Charges are optional.",200,command_giveitem) || @@ -709,77 +688,6 @@ void command_resetaa(Client* c,const Seperator *sep){ c->Message(0,"Usage: Target a client and use #resetaa to reset the AA data in their Profile."); } -void command_sendop(Client *c,const Seperator *sep){ - - int RezSpell = 0; - - if(sep->arg[1][0]) { - RezSpell = atoi(sep->arg[1]); - } - - EQApplicationPacket* outapp = new EQApplicationPacket(OP_RezzRequest, sizeof(Resurrect_Struct)); - Resurrect_Struct *rs = (Resurrect_Struct*)outapp->pBuffer; - - strcpy(rs->your_name, c->GetName()); - strcpy(rs->rezzer_name, "A Cleric01"); - rs->spellid = RezSpell; - DumpPacket(outapp); - c->QueuePacket(outapp); - safe_delete(outapp); - return; -} - -void command_optest(Client *c, const Seperator *sep) -{ - if(sep->IsNumber(1)) - { - switch(atoi(sep->arg[1])) - { - case 1: - { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_AdventureFinish, sizeof(AdventureFinish_Struct)); - AdventureFinish_Struct *af = (AdventureFinish_Struct*)outapp->pBuffer; - af->win_lose = 1; - af->points = 125; - c->FastQueuePacket(&outapp); - break; - } - case 2: - { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_AdventureData, sizeof(AdventureRequestResponse_Struct)); - AdventureRequestResponse_Struct *arr = (AdventureRequestResponse_Struct*)outapp->pBuffer; - if(sep->IsHexNumber(2)) - arr->unknown000 = hextoi(sep->arg[2]); - else - arr->unknown000 = 0xBFC40100; - arr->risk = 1; - arr->showcompass = 1; - strcpy(arr->text, "This is some text for an adventure packet!\0"); - arr->timeleft = 60*60; - //arr->timetoenter = 30*60; - if(sep->IsHexNumber(3)) - arr->unknown2080=hextoi(sep->arg[3]); - else - arr->unknown2080=0x0A; - arr->x = c->GetY(); - arr->y = c->GetX(); - arr->z = c->GetZ(); - c->FastQueuePacket(&outapp); - break; - } - case 3: - { - c->SendMarqueeMessage(15, 250, 0, 500, 5000, "Some msg"); - break; - } - default: - { - break; - } - } - } -} - void command_help(Client *c, const Seperator *sep) { int commands_shown=0; @@ -838,50 +746,6 @@ void command_serversidename(Client *c, const Seperator *sep) c->Message(0, "Error: no target"); } -void command_testspawnkill(Client *c, const Seperator *sep) -{ -/* EQApplicationPacket* outapp = new EQApplicationPacket(OP_Death, sizeof(Death_Struct)); - Death_Struct* d = (Death_Struct*)outapp->pBuffer; - d->corpseid = 1000; - // d->unknown011 = 0x05; - d->spawn_id = 1000; - d->killer_id = c->GetID(); - d->damage = 1; - d->spell_id = 0; - d->type = BASH; - d->bindzoneid = 0; - c->FastQueuePacket(&outapp);*/ -} - -void command_testspawn(Client *c, const Seperator *sep) -{ - if (sep->IsNumber(1)) { - EQApplicationPacket* outapp = new EQApplicationPacket(OP_NewSpawn, sizeof(NewSpawn_Struct)); - NewSpawn_Struct* ns = (NewSpawn_Struct*)outapp->pBuffer; - c->FillSpawnStruct(ns, c); - strcpy(ns->spawn.name, "Test"); - ns->spawn.spawnId = 1000; - ns->spawn.NPC = 1; - if (sep->IsHexNumber(2)) { - if (strlen(sep->arg[2]) >= 3) // 0x00, 1 byte - *(&((uint8*) &ns->spawn)[atoi(sep->arg[1])]) = hextoi(sep->arg[2]); - else if (strlen(sep->arg[2]) >= 5) // 0x0000, 2 bytes - *((uint16*) &(((uint8*) &ns->spawn)[atoi(sep->arg[1])])) = hextoi(sep->arg[2]); - else if (strlen(sep->arg[2]) >= 9) // 0x0000, 2 bytes - *((uint32*) &(((uint8*) &ns->spawn)[atoi(sep->arg[1])])) = hextoi(sep->arg[2]); - else - c->Message(0, "Error: unexpected hex string length"); - } - else { - strcpy((char*) (&((uint8*) &ns->spawn)[atoi(sep->arg[1])]), sep->argplus[2]); - } - EncryptSpawnPacket(outapp); - c->FastQueuePacket(&outapp); - } - else - c->Message(0, "Usage: #testspawn [memloc] [value] - spawns a NPC for you only, with the specified values set in the spawn struct"); -} - void command_wc(Client *c, const Seperator *sep) { if(sep->argnum < 2) @@ -927,12 +791,6 @@ void command_wc(Client *c, const Seperator *sep) } } -void command_numauths(Client *c, const Seperator *sep) -{ - c->Message(0, "NumAuths: %i", zone->CountAuth()); - c->Message(0, "Your WID: %i", c->GetWID()); -} - void command_setanim(Client *c, const Seperator *sep) { if (c->GetTarget() && sep->IsNumber(1)) { @@ -972,13 +830,6 @@ char buffer[255]; #endif } -void command_crashtest(Client *c, const Seperator *sep) -{ - c->Message(0,"Alright, now we get an GPF ;) "); - char* gpf=0; - memcpy(gpf, "Ready to crash", 30); -} - void command_getvariable(Client *c, const Seperator *sep) { char tmp[512]; @@ -997,71 +848,6 @@ void command_chat(Client *c, const Seperator *sep) c->Message(0, "Error: World server disconnected"); } -void command_showpetspell(Client *c, const Seperator *sep) -{ - if (sep->arg[1][0] == 0) - c->Message(0, "Usage: #ShowPetSpells [spellid | searchstring]"); - else if (SPDAT_RECORDS <= 0) - c->Message(0, "Spells not loaded"); - else if (Seperator::IsNumber(sep->argplus[1])) - { - int spellid = atoi(sep->argplus[1]); - if (spellid <= 0 || spellid >= SPDAT_RECORDS) - c->Message(0, "Error: Number out of range"); - else - c->Message(0, " %i: %s, %s", spellid, spells[spellid].teleport_zone, spells[spellid].name); - } - else - { - int count=0; - char sName[64]; - char sCriteria[65]; - strn0cpy(sCriteria, sep->argplus[1], 64); - strupr(sCriteria); - for (int i = 0; i < SPDAT_RECORDS; i++) - { - if (spells[i].name[0] != 0 && (spells[i].effectid[0] == SE_SummonPet || spells[i].effectid[0] == SE_NecPet)) - { - strcpy(sName, spells[i].teleport_zone); - strupr(sName); - char* pdest = strstr(sName, sCriteria); - if ((pdest != nullptr) && (count <=20)) - { - c->Message(0, " %i: %s, %s", i, spells[i].teleport_zone, spells[i].name); - count++; - } - else if (count > 20) - break; - } - } - if (count > 20) - c->Message(0, "20 spells found... max reached."); - else - c->Message(0, "%i spells found.", count); - } -} - -#ifdef IPC -void command_ipc(Client *c, const Seperator *sep) -{ - if (c->GetTarget() && c->GetTarget()->IsNPC()) - { - if (c->GetTarget()->CastToNPC()->IsInteractive()) - { - c->GetTarget()->CastToNPC()->interactive = false; - c->Message(0, "Disabling IPC"); - } - else - { - c->GetTarget()->CastToNPC()->interactive = true; - c->Message(0, "Enabling IPC"); - } - } - else - c->Message(0, "Error: You must target an NPC"); -} -#endif /* IPC */ - void command_npcloot(Client *c, const Seperator *sep) { if (c->GetTarget() == 0) @@ -1641,16 +1427,6 @@ void command_timezone(Client *c, const Seperator *sep) } } -void command_synctod(Client *c, const Seperator *sep) -{ - c->Message(13, "Updating Time/Date for all clients in zone..."); - EQApplicationPacket* outapp = new EQApplicationPacket(OP_TimeOfDay, sizeof(TimeOfDay_Struct)); - TimeOfDay_Struct* tod = (TimeOfDay_Struct*)outapp->pBuffer; - zone->zone_time.getEQTimeOfDay(time(0), tod); - entity_list.QueueClients(c, outapp); - safe_delete(outapp); -} - void command_invul(Client *c, const Seperator *sep) { bool state=atobool(sep->arg[1]); @@ -1714,15 +1490,6 @@ void command_fov(Client *c, const Seperator *sep) c->Message(0, "I Need a target!"); } -void command_manastat(Client *c, const Seperator *sep) -{ - Mob *target=c->GetTarget()?c->GetTarget():c; - - c->Message(0, "Mana for %s:", target->GetName()); - c->Message(0, " Current Mana: %d",target->GetMana()); - c->Message(0, " Max Mana: %d",target->GetMaxMana()); -} - void command_npcstats(Client *c, const Seperator *sep) { if (c->GetTarget() == 0) @@ -5915,19 +5682,6 @@ void command_interrupt(Client *c, const Seperator *sep) c->InterruptSpell(ci_message, ci_color); } -void command_d1(Client *c, const Seperator *sep) -{ - EQApplicationPacket app(OP_Action, sizeof(Action_Struct)); - Action_Struct* a = (Action_Struct*)app.pBuffer; - a->target = c->GetTarget()->GetID(); - a->source = c->GetID(); - a->type = atoi(sep->arg[1]); - a->spell = atoi(sep->arg[2]); - a->sequence = atoi(sep->arg[3]); - app.priority = 1; - entity_list.QueueCloseClients(c, &app); -} - void command_summonitem(Client *c, const Seperator *sep) { if (!sep->IsNumber(1)) @@ -10871,28 +10625,6 @@ void command_picklock(Client *c, const Seperator *sep) } } -void command_qtest(Client *c, const Seperator *sep) -{ - - - if(c && sep->arg[1][0]) - { - if(c->GetTarget()) - { - ServerPacket* pack = new ServerPacket(ServerOP_Speech, sizeof(Server_Speech_Struct)+strlen(sep->arg[1])+1); - Server_Speech_Struct* sem = (Server_Speech_Struct*) pack->pBuffer; - strcpy(sem->message, sep->arg[1]); - sem->minstatus = c->Admin(); - sem->type = 1; - strncpy(sem->to,c->GetTarget()->GetCleanName(), 64); - strncpy(sem->to,c->GetCleanName(), 64); - sem->guilddbid = c->GuildID(); - worldserver.SendPacket(pack); - safe_delete(pack); - } - } -} - void command_mysql(Client *c, const Seperator *sep) { if(!sep->arg[1][0] || !sep->arg[2][0]) { diff --git a/zone/lua_client.cpp b/zone/lua_client.cpp index 56abe5f09..22e38b21d 100644 --- a/zone/lua_client.cpp +++ b/zone/lua_client.cpp @@ -235,19 +235,24 @@ void Lua_Client::SetBindPoint(int to_zone) { self->SetBindPoint(to_zone); } -void Lua_Client::SetBindPoint(int to_zone, float new_x) { +void Lua_Client::SetBindPoint(int to_zone, int to_instance) { Lua_Safe_Call_Void(); - self->SetBindPoint(to_zone, new_x); + self->SetBindPoint(to_zone, to_instance); } -void Lua_Client::SetBindPoint(int to_zone, float new_x, float new_y) { +void Lua_Client::SetBindPoint(int to_zone, int to_instance, float new_x) { Lua_Safe_Call_Void(); - self->SetBindPoint(to_zone, new_x, new_y); + self->SetBindPoint(to_zone, to_instance, new_x); } -void Lua_Client::SetBindPoint(int to_zone, float new_x, float new_y, float new_z) { +void Lua_Client::SetBindPoint(int to_zone, int to_instance, float new_x, float new_y) { Lua_Safe_Call_Void(); - self->SetBindPoint(to_zone, new_x, new_y, new_z); + self->SetBindPoint(to_zone, to_instance, new_x, new_y); +} + +void Lua_Client::SetBindPoint(int to_zone, int to_instance, float new_x, float new_y, float new_z) { + Lua_Safe_Call_Void(); + self->SetBindPoint(to_zone, to_instance, new_x, new_y, new_z); } float Lua_Client::GetBindX() { @@ -1297,9 +1302,10 @@ luabind::scope lua_register_client() { .def("SetEXP", (void(Lua_Client::*)(uint32,uint32,bool))&Lua_Client::SetEXP) .def("SetBindPoint", (void(Lua_Client::*)(void))&Lua_Client::SetBindPoint) .def("SetBindPoint", (void(Lua_Client::*)(int))&Lua_Client::SetBindPoint) - .def("SetBindPoint", (void(Lua_Client::*)(int,float))&Lua_Client::SetBindPoint) - .def("SetBindPoint", (void(Lua_Client::*)(int,float,float))&Lua_Client::SetBindPoint) - .def("SetBindPoint", (void(Lua_Client::*)(int,float,float,float))&Lua_Client::SetBindPoint) + .def("SetBindPoint", (void(Lua_Client::*)(int,int))&Lua_Client::SetBindPoint) + .def("SetBindPoint", (void(Lua_Client::*)(int,int,float))&Lua_Client::SetBindPoint) + .def("SetBindPoint", (void(Lua_Client::*)(int,int,float,float))&Lua_Client::SetBindPoint) + .def("SetBindPoint", (void(Lua_Client::*)(int,int,float,float, float))&Lua_Client::SetBindPoint) .def("GetBindX", (float(Lua_Client::*)(void))&Lua_Client::GetBindX) .def("GetBindX", (float(Lua_Client::*)(int))&Lua_Client::GetBindX) .def("GetBindY", (float(Lua_Client::*)(void))&Lua_Client::GetBindY) diff --git a/zone/lua_client.h b/zone/lua_client.h index ef2af1181..e2b0a6614 100644 --- a/zone/lua_client.h +++ b/zone/lua_client.h @@ -73,9 +73,10 @@ public: void SetEXP(uint32 set_exp, uint32 set_aaxp, bool resexp); void SetBindPoint(); void SetBindPoint(int to_zone); - void SetBindPoint(int to_zone, float new_x); - void SetBindPoint(int to_zone, float new_x, float new_y); - void SetBindPoint(int to_zone, float new_x, float new_y, float new_z); + void SetBindPoint(int to_zone, int to_instance); + void SetBindPoint(int to_zone, int to_instance, float new_x); + void SetBindPoint(int to_zone, int to_instance, float new_x, float new_y); + void SetBindPoint(int to_zone, int to_instance, float new_x, float new_y, float new_z); float GetBindX(); float GetBindX(int index); float GetBindY(); diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index d58ea21bc..09b0dcf53 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -1249,6 +1249,152 @@ double lua_clock() { return static_cast(t) / 1000.0; } +#define LuaCreateNPCParse(name, c_type, default_value) do { \ + cur = table[#name]; \ + if(luabind::type(cur) != LUA_TNIL) { \ + try { \ + npc_type->name = luabind::object_cast(cur); \ + } \ + catch(luabind::cast_failed) { \ + npc_type->size = default_value; \ + } \ + } \ + else { \ + npc_type->size = default_value; \ + } \ +} while(0) + +#define LuaCreateNPCParseString(name, str_length, default_value) do { \ + cur = table[#name]; \ + if(luabind::type(cur) != LUA_TNIL) { \ + try { \ + std::string tmp = luabind::object_cast(cur); \ + strncpy(npc_type->name, tmp.c_str(), str_length); \ + } \ + catch(luabind::cast_failed) { \ + strncpy(npc_type->name, default_value, str_length); \ + } \ + } \ + else { \ + strncpy(npc_type->name, default_value, str_length); \ + } \ +} while(0) + +void lua_create_npc(luabind::adl::object table, float x, float y, float z, float heading) { + if(luabind::type(table) != LUA_TTABLE) { + return; + } + + NPCType* npc_type = new NPCType; + memset(npc_type, 0, sizeof(NPCType)); + + + luabind::adl::index_proxy cur = table["name"]; + LuaCreateNPCParseString(name, 64, "_"); + LuaCreateNPCParseString(lastname, 64, ""); + LuaCreateNPCParse(cur_hp, int32, 30); + LuaCreateNPCParse(max_hp, int32, 30); + LuaCreateNPCParse(size, float, 6.0f); + LuaCreateNPCParse(runspeed, float, 1.25f); + LuaCreateNPCParse(gender, uint8, 0); + LuaCreateNPCParse(race, uint16, 1); + LuaCreateNPCParse(class_, uint8, WARRIOR); + LuaCreateNPCParse(bodytype, uint8, 0); + LuaCreateNPCParse(deity, uint8, 0); + LuaCreateNPCParse(level, uint8, 1); + LuaCreateNPCParse(npc_id, uint32, 1); + LuaCreateNPCParse(texture, uint8, 0); + LuaCreateNPCParse(helmtexture, uint8, 0); + LuaCreateNPCParse(loottable_id, uint32, 0); + LuaCreateNPCParse(npc_spells_id, uint32, 0); + LuaCreateNPCParse(npc_spells_effects_id, uint32, 0); + LuaCreateNPCParse(npc_faction_id, int32, 0); + LuaCreateNPCParse(merchanttype, uint32, 0); + LuaCreateNPCParse(alt_currency_type, uint32, 0); + LuaCreateNPCParse(adventure_template, uint32, 0); + LuaCreateNPCParse(trap_template, uint32, 0); + LuaCreateNPCParse(light, uint8, 0); + LuaCreateNPCParse(AC, uint32, 0); + LuaCreateNPCParse(Mana, uint32, 0); + LuaCreateNPCParse(ATK, uint32, 0); + LuaCreateNPCParse(STR, uint32, 75); + LuaCreateNPCParse(STA, uint32, 75); + LuaCreateNPCParse(DEX, uint32, 75); + LuaCreateNPCParse(AGI, uint32, 75); + LuaCreateNPCParse(INT, uint32, 75); + LuaCreateNPCParse(WIS, uint32, 75); + LuaCreateNPCParse(CHA, uint32, 75); + LuaCreateNPCParse(MR, int32, 25); + LuaCreateNPCParse(FR, int32, 25); + LuaCreateNPCParse(CR, int32, 25); + LuaCreateNPCParse(PR, int32, 25); + LuaCreateNPCParse(DR, int32, 25); + LuaCreateNPCParse(Corrup, int32, 25); + LuaCreateNPCParse(PhR, int32, 0); + LuaCreateNPCParse(haircolor, uint8, 0); + LuaCreateNPCParse(beardcolor, uint8, 0); + LuaCreateNPCParse(eyecolor1, uint8, 0); + LuaCreateNPCParse(eyecolor2, uint8, 0); + LuaCreateNPCParse(hairstyle, uint8, 0); + LuaCreateNPCParse(luclinface, uint8, 0); + LuaCreateNPCParse(beard, uint8, 0); + LuaCreateNPCParse(drakkin_heritage, uint32, 0); + LuaCreateNPCParse(drakkin_tattoo, uint32, 0); + LuaCreateNPCParse(drakkin_details, uint32, 0); + LuaCreateNPCParse(armor_tint[0], uint32, 0); + LuaCreateNPCParse(armor_tint[1], uint32, 0); + LuaCreateNPCParse(armor_tint[2], uint32, 0); + LuaCreateNPCParse(armor_tint[3], uint32, 0); + LuaCreateNPCParse(armor_tint[4], uint32, 0); + LuaCreateNPCParse(armor_tint[5], uint32, 0); + LuaCreateNPCParse(armor_tint[6], uint32, 0); + LuaCreateNPCParse(armor_tint[7], uint32, 0); + LuaCreateNPCParse(armor_tint[8], uint32, 0); + LuaCreateNPCParse(min_dmg, uint32, 2); + LuaCreateNPCParse(max_dmg, uint32, 4); + LuaCreateNPCParse(attack_count, int16, 0); + LuaCreateNPCParseString(special_abilities, 512, ""); + LuaCreateNPCParse(d_meele_texture1, uint16, 0); + LuaCreateNPCParse(d_meele_texture2, uint16, 0); + LuaCreateNPCParseString(ammo_idfile, 32, ""); + LuaCreateNPCParse(prim_melee_type, uint8, 0); + LuaCreateNPCParse(sec_melee_type, uint8, 0); + LuaCreateNPCParse(ranged_type, uint8, 0); + LuaCreateNPCParse(hp_regen, int32, 1); + LuaCreateNPCParse(mana_regen, int32, 1); + LuaCreateNPCParse(aggroradius, int32, 0); + LuaCreateNPCParse(assistradius, int32, 0); + LuaCreateNPCParse(see_invis, uint8, 0); + LuaCreateNPCParse(see_invis_undead, bool, false); + LuaCreateNPCParse(see_hide, bool, false); + LuaCreateNPCParse(see_improved_hide, bool, false); + LuaCreateNPCParse(qglobal, bool, false); + LuaCreateNPCParse(npc_aggro, bool, false); + LuaCreateNPCParse(spawn_limit, uint8, false); + LuaCreateNPCParse(mount_color, uint8, false); + LuaCreateNPCParse(attack_speed, float, 0); + LuaCreateNPCParse(attack_delay, uint8, 30); + LuaCreateNPCParse(accuracy_rating, int, 0); + LuaCreateNPCParse(avoidance_rating, int, 0); + LuaCreateNPCParse(findable, bool, false); + LuaCreateNPCParse(trackable, bool, false); + LuaCreateNPCParse(slow_mitigation, int16, 0); + LuaCreateNPCParse(maxlevel, uint8, 0); + LuaCreateNPCParse(scalerate, uint32, 0); + LuaCreateNPCParse(private_corpse, bool, false); + LuaCreateNPCParse(unique_spawn_by_name, bool, false); + LuaCreateNPCParse(underwater, bool, false); + LuaCreateNPCParse(emoteid, uint32, 0); + LuaCreateNPCParse(spellscale, float, 0); + LuaCreateNPCParse(healscale, float, 0); + LuaCreateNPCParse(no_target_hotkey, bool, false); + LuaCreateNPCParse(raid_target, bool, false); + LuaCreateNPCParse(probability, uint8, 0); + + NPC* npc = new NPC(npc_type, nullptr, x, y, z, heading, FlyMode3); + npc->GiveNPCTypeData(npc_type); + entity_list.AddNPC(npc); +} luabind::scope lua_register_general() { return luabind::namespace_("eq") [ @@ -1435,7 +1581,8 @@ luabind::scope lua_register_general() { luabind::def("enable_recipe", &lua_enable_recipe), luabind::def("disable_recipe", &lua_disable_recipe), luabind::def("clear_npctype_cache", &lua_clear_npctype_cache), - luabind::def("clock", &lua_clock) + luabind::def("clock", &lua_clock), + luabind::def("create_npc", &lua_create_npc) ]; } diff --git a/zone/merc.h b/zone/merc.h index 66c310759..deb5fe53b 100644 --- a/zone/merc.h +++ b/zone/merc.h @@ -4,17 +4,17 @@ #include "zonedb.h" #include "npc.h" -#define MAXMERCS 1 -#define MERC_DEBUG 0 -#define TANK 1 -#define HEALER 2 -#define MELEEDPS 9 -#define CASTERDPS 12 +#define MAXMERCS 1 +#define MERC_DEBUG 0 +#define TANK 1 +#define HEALER 2 +#define MELEEDPS 9 +#define CASTERDPS 12 -#define NO_MERC_ID 0 -#define MERC_STATE_NORMAL 5 +#define NO_MERC_ID 0 +#define MERC_STATE_NORMAL 5 #define MERC_STATE_SUSPENDED 1 -#define NOT_SUSPENDED_TIME 0 +#define NOT_SUSPENDED_TIME 0 const int MercAISpellRange = 100; // TODO: Write a method that calcs what the merc's spell range is based on spell, equipment, AA, whatever and replace this @@ -31,19 +31,19 @@ enum MercStanceType { }; struct MercSpell { - uint16 spellid; // <= 0 = no spell - uint32 type; // 0 = never, must be one (and only one) of the defined values - int16 stance; // 0 = all, + = only this stance, - = all except this stance - int16 slot; - uint16 proc_chance; - uint32 time_cancast; // when we can cast this spell next + uint16 spellid; // <= 0 = no spell + uint32 type; // 0 = never, must be one (and only one) of the defined values + int16 stance; // 0 = all, + = only this stance, - = all except this stance + int16 slot; + uint16 proc_chance; + uint32 time_cancast; // when we can cast this spell next }; struct MercTimer { - uint16 timerid; // EndurTimerIndex - uint8 timertype; // 1 = spell, 2 = disc - uint16 spellid; // <= 0 = no spell - uint32 time_cancast; // when we can cast this spell next + uint16 timerid; // EndurTimerIndex + uint8 timertype; // 1 = spell, 2 = disc + uint16 spellid; // <= 0 = no spell + uint32 time_cancast; // when we can cast this spell next }; class Merc : public NPC { @@ -170,16 +170,16 @@ public: inline const uint8 GetClientVersion() const { return _OwnerClientVersion; } virtual void SetTarget(Mob* mob); - bool HasSkill(SkillUseTypes skill_id) const; - bool CanHaveSkill(SkillUseTypes skill_id) const; - uint16 MaxSkill(SkillUseTypes skillid, uint16 class_, uint16 level) const; - inline uint16 MaxSkill(SkillUseTypes skillid) const { return MaxSkill(skillid, GetClass(), GetLevel()); } + bool HasSkill(SkillUseTypes skill_id) const; + bool CanHaveSkill(SkillUseTypes skill_id) const; + uint16 MaxSkill(SkillUseTypes skillid, uint16 class_, uint16 level) const; + inline uint16 MaxSkill(SkillUseTypes skillid) const { return MaxSkill(skillid, GetClass(), GetLevel()); } virtual void DoClassAttacks(Mob *target); - void CheckHateList(); - bool CheckTaunt(); - bool CheckAETaunt(); - bool CheckConfidence(); - bool TryHide(); + void CheckHateList(); + bool CheckTaunt(); + bool CheckAETaunt(); + bool CheckConfidence(); + bool TryHide(); // stat functions virtual void CalcBonuses(); @@ -189,56 +189,56 @@ public: inline virtual int32 GetATKBonus() const { return itembonuses.ATK + spellbonuses.ATK; } int32 GetRawACNoShield(int &shield_ac) const; - inline virtual int32 GetSTR() const { return STR; } - inline virtual int32 GetSTA() const { return STA; } - inline virtual int32 GetDEX() const { return DEX; } - inline virtual int32 GetAGI() const { return AGI; } - inline virtual int32 GetINT() const { return INT; } - inline virtual int32 GetWIS() const { return WIS; } - inline virtual int32 GetCHA() const { return CHA; } - inline virtual int32 GetMR() const { return MR; } - inline virtual int32 GetFR() const { return FR; } - inline virtual int32 GetDR() const { return DR; } - inline virtual int32 GetPR() const { return PR; } - inline virtual int32 GetCR() const { return CR; } - inline virtual int32 GetCorrup() const { return Corrup; } + inline virtual int32 GetSTR() const { return STR; } + inline virtual int32 GetSTA() const { return STA; } + inline virtual int32 GetDEX() const { return DEX; } + inline virtual int32 GetAGI() const { return AGI; } + inline virtual int32 GetINT() const { return INT; } + inline virtual int32 GetWIS() const { return WIS; } + inline virtual int32 GetCHA() const { return CHA; } + inline virtual int32 GetMR() const { return MR; } + inline virtual int32 GetFR() const { return FR; } + inline virtual int32 GetDR() const { return DR; } + inline virtual int32 GetPR() const { return PR; } + inline virtual int32 GetCR() const { return CR; } + inline virtual int32 GetCorrup() const { return Corrup; } - inline virtual int32 GetHeroicSTR() const { return itembonuses.HeroicSTR; } - inline virtual int32 GetHeroicSTA() const { return itembonuses.HeroicSTA; } - inline virtual int32 GetHeroicDEX() const { return itembonuses.HeroicDEX; } - inline virtual int32 GetHeroicAGI() const { return itembonuses.HeroicAGI; } - inline virtual int32 GetHeroicINT() const { return itembonuses.HeroicINT; } - inline virtual int32 GetHeroicWIS() const { return itembonuses.HeroicWIS; } - inline virtual int32 GetHeroicCHA() const { return itembonuses.HeroicCHA; } - inline virtual int32 GetHeroicMR() const { return itembonuses.HeroicMR; } - inline virtual int32 GetHeroicFR() const { return itembonuses.HeroicFR; } - inline virtual int32 GetHeroicDR() const { return itembonuses.HeroicDR; } - inline virtual int32 GetHeroicPR() const { return itembonuses.HeroicPR; } - inline virtual int32 GetHeroicCR() const { return itembonuses.HeroicCR; } - inline virtual int32 GetHeroicCorrup() const { return itembonuses.HeroicCorrup; } + inline virtual int32 GetHeroicSTR() const { return itembonuses.HeroicSTR; } + inline virtual int32 GetHeroicSTA() const { return itembonuses.HeroicSTA; } + inline virtual int32 GetHeroicDEX() const { return itembonuses.HeroicDEX; } + inline virtual int32 GetHeroicAGI() const { return itembonuses.HeroicAGI; } + inline virtual int32 GetHeroicINT() const { return itembonuses.HeroicINT; } + inline virtual int32 GetHeroicWIS() const { return itembonuses.HeroicWIS; } + inline virtual int32 GetHeroicCHA() const { return itembonuses.HeroicCHA; } + inline virtual int32 GetHeroicMR() const { return itembonuses.HeroicMR; } + inline virtual int32 GetHeroicFR() const { return itembonuses.HeroicFR; } + inline virtual int32 GetHeroicDR() const { return itembonuses.HeroicDR; } + inline virtual int32 GetHeroicPR() const { return itembonuses.HeroicPR; } + inline virtual int32 GetHeroicCR() const { return itembonuses.HeroicCR; } + inline virtual int32 GetHeroicCorrup() const { return itembonuses.HeroicCorrup; } // Mod2 - inline virtual int32 GetShielding() const { return itembonuses.MeleeMitigation; } - inline virtual int32 GetSpellShield() const { return itembonuses.SpellShield; } - inline virtual int32 GetDoTShield() const { return itembonuses.DoTShielding; } - inline virtual int32 GetStunResist() const { return itembonuses.StunResist; } - inline virtual int32 GetStrikeThrough() const { return itembonuses.StrikeThrough; } - inline virtual int32 GetAvoidance() const { return itembonuses.AvoidMeleeChance; } - inline virtual int32 GetAccuracy() const { return itembonuses.HitChance; } - inline virtual int32 GetCombatEffects() const { return itembonuses.ProcChance; } - inline virtual int32 GetDS() const { return itembonuses.DamageShield; } + inline virtual int32 GetShielding() const { return itembonuses.MeleeMitigation; } + inline virtual int32 GetSpellShield() const { return itembonuses.SpellShield; } + inline virtual int32 GetDoTShield() const { return itembonuses.DoTShielding; } + inline virtual int32 GetStunResist() const { return itembonuses.StunResist; } + inline virtual int32 GetStrikeThrough() const { return itembonuses.StrikeThrough; } + inline virtual int32 GetAvoidance() const { return itembonuses.AvoidMeleeChance; } + inline virtual int32 GetAccuracy() const { return itembonuses.HitChance; } + inline virtual int32 GetCombatEffects() const { return itembonuses.ProcChance; } + inline virtual int32 GetDS() const { return itembonuses.DamageShield; } // Mod3 - inline virtual int32 GetHealAmt() const { return itembonuses.HealAmt; } - inline virtual int32 GetSpellDmg() const { return itembonuses.SpellDmg; } - inline virtual int32 GetClair() const { return itembonuses.Clairvoyance; } - inline virtual int32 GetDSMit() const { return itembonuses.DSMitigation; } + inline virtual int32 GetHealAmt() const { return itembonuses.HealAmt; } + inline virtual int32 GetSpellDmg() const { return itembonuses.SpellDmg; } + inline virtual int32 GetClair() const { return itembonuses.Clairvoyance; } + inline virtual int32 GetDSMit() const { return itembonuses.DSMitigation; } - inline virtual int32 GetSingMod() const { return itembonuses.singingMod; } - inline virtual int32 GetBrassMod() const { return itembonuses.brassMod; } - inline virtual int32 GetPercMod() const { return itembonuses.percussionMod; } - inline virtual int32 GetStringMod() const { return itembonuses.stringedMod; } - inline virtual int32 GetWindMod() const { return itembonuses.windMod; } + inline virtual int32 GetSingMod() const { return itembonuses.singingMod; } + inline virtual int32 GetBrassMod() const { return itembonuses.brassMod; } + inline virtual int32 GetPercMod() const { return itembonuses.percussionMod; } + inline virtual int32 GetStringMod() const { return itembonuses.stringedMod; } + inline virtual int32 GetWindMod() const { return itembonuses.windMod; } - inline virtual int32 GetDelayDeath() const { return aabonuses.DelayDeath + spellbonuses.DelayDeath + itembonuses.DelayDeath + 11; } + inline virtual int32 GetDelayDeath() const { return aabonuses.DelayDeath + spellbonuses.DelayDeath + itembonuses.DelayDeath + 11; } // "SET" Class Methods void SetMercData (uint32 templateID ); @@ -279,53 +279,53 @@ protected: std::map timers; uint16 skills[HIGHEST_SKILL+1]; - uint32 equipment[EmuConstants::EQUIPMENT_SIZE]; //this is an array of item IDs - uint16 d_meele_texture1; //this is an item Material value - uint16 d_meele_texture2; //this is an item Material value (offhand) - uint8 prim_melee_type; //Sets the Primary Weapon attack message and animation - uint8 sec_melee_type; //Sets the Secondary Weapon attack message and animation + uint32 equipment[EmuConstants::EQUIPMENT_SIZE]; //this is an array of item IDs + uint16 d_meele_texture1; //this is an item Material value + uint16 d_meele_texture2; //this is an item Material value (offhand) + uint8 prim_melee_type; //Sets the Primary Weapon attack message and animation + uint8 sec_melee_type; //Sets the Secondary Weapon attack message and animation private: - int32 CalcAC(); - int32 GetACMit(); - int32 GetACAvoid(); - int32 acmod(); - int32 CalcATK(); - //int CalcHaste(); + int32 CalcAC(); + int32 GetACMit(); + int32 GetACAvoid(); + int32 acmod(); + int32 CalcATK(); + //int CalcHaste(); - int32 CalcSTR(); - int32 CalcSTA(); - int32 CalcDEX(); - int32 CalcAGI(); - int32 CalcINT(); - int32 CalcWIS(); - int32 CalcCHA(); + int32 CalcSTR(); + int32 CalcSTA(); + int32 CalcDEX(); + int32 CalcAGI(); + int32 CalcINT(); + int32 CalcWIS(); + int32 CalcCHA(); - int32 CalcMR(); - int32 CalcFR(); - int32 CalcDR(); - int32 CalcPR(); - int32 CalcCR(); - int32 CalcCorrup(); - int32 CalcMaxHP(); - int32 CalcBaseHP(); - int32 GetClassHPFactor(); - int32 CalcHPRegen(); - int32 CalcHPRegenCap(); - int32 CalcMaxMana(); - int32 CalcBaseMana(); - int32 CalcManaRegen(); - int32 CalcBaseManaRegen(); - int32 CalcManaRegenCap(); - void CalcMaxEndurance(); //This calculates the maximum endurance we can have - int32 CalcBaseEndurance(); //Calculates Base End - int32 GetMaxEndurance() const {return max_end;} //This gets our endurance from the last CalcMaxEndurance() call - int32 CalcEnduranceRegen(); //Calculates endurance regen used in DoEnduranceRegen() - int32 CalcEnduranceRegenCap(); - void SetEndurance(int32 newEnd); //This sets the current endurance to the new value - void DoEnduranceUpkeep(); //does the endurance upkeep - void CalcRestState(); + int32 CalcMR(); + int32 CalcFR(); + int32 CalcDR(); + int32 CalcPR(); + int32 CalcCR(); + int32 CalcCorrup(); + int32 CalcMaxHP(); + int32 CalcBaseHP(); + int32 GetClassHPFactor(); + int32 CalcHPRegen(); + int32 CalcHPRegenCap(); + int32 CalcMaxMana(); + int32 CalcBaseMana(); + int32 CalcManaRegen(); + int32 CalcBaseManaRegen(); + int32 CalcManaRegenCap(); + void CalcMaxEndurance(); //This calculates the maximum endurance we can have + int32 CalcBaseEndurance(); //Calculates Base End + int32 GetMaxEndurance() const {return max_end;} //This gets our endurance from the last CalcMaxEndurance() call + int32 CalcEnduranceRegen(); //Calculates endurance regen used in DoEnduranceRegen() + int32 CalcEnduranceRegenCap(); + void SetEndurance(int32 newEnd); //This sets the current endurance to the new value + void DoEnduranceUpkeep(); //does the endurance upkeep + void CalcRestState(); int GroupLeadershipAAHealthEnhancement(); int GroupLeadershipAAManaEnhancement(); @@ -351,8 +351,8 @@ private: uint32 _baseWIS; uint32 _baseCHA; uint32 _baseATK; - uint32 _baseRace; // Necessary to preserve the race otherwise mercs get their race updated in the db when they get an illusion. - uint8 _baseGender; // Merc gender. Necessary to preserve the original value otherwise it can be changed by illusions. + uint32 _baseRace; // Necessary to preserve the race otherwise mercs get their race updated in the db when they get an illusion. + uint8 _baseGender; // Merc gender. Necessary to preserve the original value otherwise it can be changed by illusions. uint32 _baseMR; uint32 _baseCR; uint32 _baseDR; diff --git a/zone/npc.cpp b/zone/npc.cpp index d1bdee979..25a349048 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -1924,6 +1924,7 @@ void NPC::ModifyNPCStat(const char *identifier, const char *newValue) else if(id == "PhR") { PhR = atoi(val.c_str()); return; } else if(id == "runspeed") { runspeed = (float)atof(val.c_str()); CalcBonuses(); return; } else if(id == "special_attacks") { NPCSpecialAttacks(val.c_str(), 0, 1); return; } + else if(id == "special_abilities") { ProcessSpecialAbilities(val.c_str()); return; } else if(id == "attack_speed") { attack_speed = (float)atof(val.c_str()); CalcBonuses(); return; } else if(id == "atk") { ATK = atoi(val.c_str()); return; } else if(id == "accuracy") { accuracy_rating = atoi(val.c_str()); return; } diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index aaaa5899f..2a0c055af 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -1023,11 +1023,12 @@ XS(XS_Client_SetBindPoint); /* prototype to pass -Wmissing-prototypes */ XS(XS_Client_SetBindPoint) { dXSARGS; - if (items < 1 || items > 5) - Perl_croak(aTHX_ "Usage: Client::SetBindPoint(THIS, to_zone= -1, new_x= 0.0f, new_y= 0.0f, new_z= 0.0f)"); + if (items < 1 || items > 6) + Perl_croak(aTHX_ "Usage: Client::SetBindPoint(THIS, to_zone= -1, to_instance = 0, new_x= 0.0f, new_y= 0.0f, new_z= 0.0f)"); { Client * THIS; int to_zone; + int to_instance; float new_x; float new_y; float new_z; @@ -1047,25 +1048,31 @@ XS(XS_Client_SetBindPoint) to_zone = (int)SvIV(ST(1)); } - if (items < 3) - new_x = 0.0f; + if(items < 3) + to_instance = 0; else { - new_x = (float)SvNV(ST(2)); + to_instance = (int)SvIV(ST(2)); } if (items < 4) - new_y = 0.0f; + new_x = 0.0f; else { - new_y = (float)SvNV(ST(3)); + new_x = (float)SvNV(ST(3)); } if (items < 5) - new_z = 0.0f; + new_y = 0.0f; else { - new_z = (float)SvNV(ST(4)); + new_y = (float)SvNV(ST(4)); } - THIS->SetBindPoint(to_zone, new_x, new_y, new_z); + if (items < 6) + new_z = 0.0f; + else { + new_z = (float)SvNV(ST(5)); + } + + THIS->SetBindPoint(to_zone, to_instance, new_x, new_y, new_z); } XSRETURN_EMPTY; } @@ -6155,7 +6162,7 @@ XS(boot_Client) newXSproto(strcpy(buf, "SetDeity"), XS_Client_SetDeity, file, "$$"); newXSproto(strcpy(buf, "AddEXP"), XS_Client_AddEXP, file, "$$;$$"); newXSproto(strcpy(buf, "SetEXP"), XS_Client_SetEXP, file, "$$$;$"); - newXSproto(strcpy(buf, "SetBindPoint"), XS_Client_SetBindPoint, file, "$;$$$$"); + newXSproto(strcpy(buf, "SetBindPoint"), XS_Client_SetBindPoint, file, "$;$$$$$"); newXSproto(strcpy(buf, "GetBindX"), XS_Client_GetBindX, file, "$$"); newXSproto(strcpy(buf, "GetBindY"), XS_Client_GetBindY, file, "$$"); newXSproto(strcpy(buf, "GetBindZ"), XS_Client_GetBindZ, file, "$$"); diff --git a/zone/perl_mob.cpp b/zone/perl_mob.cpp index af63066ff..c47b463d3 100644 --- a/zone/perl_mob.cpp +++ b/zone/perl_mob.cpp @@ -8187,6 +8187,158 @@ XS(XS_Mob_GetSpellStat) XSRETURN(1); } +XS(XS_Mob_GetSpecialAbility); /* prototype to pass -Wmissing-prototypes */ +XS(XS_Mob_GetSpecialAbility) +{ + dXSARGS; + if(items != 2) + Perl_croak(aTHX_ "Usage: Mob::GetSpecialAbility(THIS, special_ability)"); + { + int RETVAL; + Mob* THIS; + int ability = SvIV(ST(1)); + dXSTARG; + + if(sv_derived_from(ST(0), "Mob")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(Mob *, tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type Mob"); + if(THIS == nullptr) + Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); + + RETVAL = THIS->GetSpecialAbility(ability); + XSprePUSH; PUSHi((IV)RETVAL); + } + XSRETURN(1); +} + +XS(XS_Mob_GetSpecialAbilityParam); /* prototype to pass -Wmissing-prototypes */ +XS(XS_Mob_GetSpecialAbilityParam) +{ + dXSARGS; + if(items != 3) + Perl_croak(aTHX_ "Usage: Mob::GetSpecialAbilityParam(THIS, special_ability, param)"); + { + int RETVAL; + Mob* THIS; + int ability = SvIV(ST(1)); + int param = SvIV(ST(2)); + dXSTARG; + + if(sv_derived_from(ST(0), "Mob")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(Mob *, tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type Mob"); + if(THIS == nullptr) + Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); + + RETVAL = THIS->GetSpecialAbilityParam(ability, param); + XSprePUSH; PUSHi((IV)RETVAL); + } + XSRETURN(1); +} + +XS(XS_Mob_SetSpecialAbility); /* prototype to pass -Wmissing-prototypes */ +XS(XS_Mob_SetSpecialAbility) +{ + dXSARGS; + if(items != 3) + Perl_croak(aTHX_ "Usage: Mob::SetSpecialAbility(THIS, ability, value)"); + { + Mob* THIS; + int ability = SvIV(ST(1)); + int value = SvIV(ST(2)); + + if(sv_derived_from(ST(0), "Mob")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(Mob *, tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type Mob"); + if(THIS == nullptr) + Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); + + THIS->SetSpecialAbility(ability, value); + } + XSRETURN_EMPTY; +} + +XS(XS_Mob_SetSpecialAbilityParam); /* prototype to pass -Wmissing-prototypes */ +XS(XS_Mob_SetSpecialAbilityParam) +{ + dXSARGS; + if(items != 4) + Perl_croak(aTHX_ "Usage: Mob::SetSpecialAbilityParam(THIS, ability, param, value)"); + { + Mob* THIS; + int ability = SvIV(ST(1)); + int param = SvIV(ST(2)); + int value = SvIV(ST(3)); + + if(sv_derived_from(ST(0), "Mob")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(Mob *, tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type Mob"); + if(THIS == nullptr) + Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); + + THIS->SetSpecialAbilityParam(ability, param, value); + } + XSRETURN_EMPTY; +} + +XS(XS_Mob_ClearSpecialAbilities); /* prototype to pass -Wmissing-prototypes */ +XS(XS_Mob_ClearSpecialAbilities) +{ + dXSARGS; + if(items != 1) + Perl_croak(aTHX_ "Usage: Mob::ClearSpecialAbilities(THIS)"); + { + Mob* THIS; + + if(sv_derived_from(ST(0), "Mob")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(Mob *, tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type Mob"); + if(THIS == nullptr) + Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); + + THIS->ClearSpecialAbilities(); + } + XSRETURN_EMPTY; +} + +XS(XS_Mob_ProcessSpecialAbilities); /* prototype to pass -Wmissing-prototypes */ +XS(XS_Mob_ProcessSpecialAbilities) +{ + dXSARGS; + if(items != 2) + Perl_croak(aTHX_ "Usage: Mob::ProcessSpecialAbilities(THIS, str)"); + { + Mob* THIS; + const char *str = (const char*)SvPV_nolen(ST(1)); + + if(sv_derived_from(ST(0), "Mob")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(Mob *, tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type Mob"); + if(THIS == nullptr) + Perl_croak(aTHX_ "THIS is nullptr, avoiding crash."); + + THIS->ProcessSpecialAbilities(str); + } + XSRETURN_EMPTY; +} #ifdef __cplusplus extern "C" @@ -8485,11 +8637,16 @@ XS(boot_Mob) newXSproto(strcpy(buf, "DoArcheryAttackDmg"), XS_Mob_DoArcheryAttackDmg, file, "$$$$$$$"); newXSproto(strcpy(buf, "DoThrowingAttackDmg"), XS_Mob_DoThrowingAttackDmg, file, "$$$$$$$"); newXSproto(strcpy(buf, "SetDisableMelee"), XS_Mob_SetDisableMelee, file, "$$"); - newXSproto(strcpy(buf, "IsMeleeDisabled"), XS_Mob_IsMeleeDisabled, file, "$$"); + newXSproto(strcpy(buf, "IsMeleeDisabled"), XS_Mob_IsMeleeDisabled, file, "$"); newXSproto(strcpy(buf, "SetFlurryChance"), XS_Mob_SetFlurryChance, file, "$$"); newXSproto(strcpy(buf, "GetFlurryChance"), XS_Mob_GetFlurryChance, file, "$"); newXSproto(strcpy(buf, "GetSpellStat"), XS_Mob_GetSpellStat, file, "$$$$"); - + newXSproto(strcpy(buf, "GetSpecialAbility"), XS_Mob_GetSpecialAbility, file, "$$"); + newXSproto(strcpy(buf, "GetSpecialAbilityParam"), XS_Mob_GetSpecialAbilityParam, file, "$$$"); + newXSproto(strcpy(buf, "SetSpecialAbility"), XS_Mob_SetSpecialAbility, file, "$$$"); + newXSproto(strcpy(buf, "SetSpecialAbilityParam"), XS_Mob_SetSpecialAbilityParam, file, "$$$$"); + newXSproto(strcpy(buf, "ClearSpecialAbilities"), XS_Mob_ClearSpecialAbilities, file, "$"); + newXSproto(strcpy(buf, "ProcessSpecialAbilities"), XS_Mob_ProcessSpecialAbilities, file, "$$"); XSRETURN_YES; } diff --git a/zone/qglobals.cpp b/zone/qglobals.cpp index f63e13dd4..bc7bf680e 100644 --- a/zone/qglobals.cpp +++ b/zone/qglobals.cpp @@ -172,5 +172,5 @@ void QGlobalCache::LoadBy(const std::string &query) return; for (auto row = results.begin(); row != results.end(); ++row) - AddGlobal(0, QGlobal(std::string(row[0]), atoi(row[1]), atoi(row[2]), atoi(row[3]), row[4], row[5]? atoi(row[5]): 0xFFFFFFFF)); + AddGlobal(0, QGlobal(row[0], atoi(row[1]), atoi(row[2]), atoi(row[3]), row[4], row[5] ? atoi(row[5]) : 0xFFFFFFFF)); } diff --git a/zone/zone.cpp b/zone/zone.cpp index 7a4ad8bac..521684a0d 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -755,6 +755,7 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) zoneid = in_zoneid; instanceid = in_instanceid; instanceversion = database.GetInstanceVersion(instanceid); + pers_instance = false; zonemap = nullptr; watermap = nullptr; pathing = nullptr; @@ -824,11 +825,12 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name) if(!is_perma) { if(rem < 150) //give some leeway to people who are zoning in 2.5 minutes to finish zoning in and get ported out - rem = 150; + rem = 150; Instance_Timer = new Timer(rem * 1000); } else { + pers_instance = true; Instance_Timer = nullptr; } } diff --git a/zone/zone.h b/zone/zone.h index 9ad692fa0..0fa390512 100644 --- a/zone/zone.h +++ b/zone/zone.h @@ -104,6 +104,7 @@ public: inline const uint32 GetZoneID() const { return zoneid; } inline const uint32 GetInstanceID() const { return instanceid; } inline const uint16 GetInstanceVersion() const { return instanceversion; } + inline const bool IsInstancePersistent() const { return pers_instance; } inline const uint8 GetZoneType() const { return zone_type; } inline Timer* GetInstanceTimer() { return Instance_Timer; } @@ -274,6 +275,7 @@ private: uint32 zoneid; uint32 instanceid; uint16 instanceversion; + bool pers_instance; char* short_name; char file_name[16]; char* long_name; diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index fa34e8d9e..bfbdb7424 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1197,21 +1197,21 @@ bool ZoneDatabase::LoadCharacterBindPoint(uint32 character_id, PlayerProfile_Str i = 0; /* Is home bind */ if (atoi(row[6]) == 1){ - pp->binds[4].zoneId = atoi(row[i]); i++; - i++; /* Instance ID can go here eventually */ - pp->binds[4].x = atoi(row[i]); i++; - pp->binds[4].y = atoi(row[i]); i++; - pp->binds[4].z = atoi(row[i]); i++; - pp->binds[4].heading = atoi(row[i]); i++; + pp->binds[4].zoneId = atoi(row[i++]); + pp->binds[4].instance_id = atoi(row[i++]); + pp->binds[4].x = atoi(row[i++]); + pp->binds[4].y = atoi(row[i++]); + pp->binds[4].z = atoi(row[i++]); + pp->binds[4].heading = atoi(row[i++]); } /* Is regular bind point */ else{ - pp->binds[0].zoneId = atoi(row[i]); i++; - i++; /* Instance ID can go here eventually */ - pp->binds[0].x = atoi(row[i]); i++; - pp->binds[0].y = atoi(row[i]); i++; - pp->binds[0].z = atoi(row[i]); i++; - pp->binds[0].heading = atoi(row[i]); i++; + pp->binds[0].zoneId = atoi(row[i++]); + pp->binds[0].instance_id = atoi(row[i++]); + pp->binds[0].x = atoi(row[i++]); + pp->binds[0].y = atoi(row[i++]); + pp->binds[0].z = atoi(row[i++]); + pp->binds[0].heading = atoi(row[i++]); } } return true; @@ -1224,12 +1224,18 @@ bool ZoneDatabase::SaveCharacterLanguage(uint32 character_id, uint32 lang_id, ui } bool ZoneDatabase::SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, uint32 instance_id, float x, float y, float z, float heading, uint8 is_home){ - if (zone_id <= 0){ return false; } + if (zone_id <= 0) { + return false; + } + /* Save Home Bind Point */ std::string query = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)" " VALUES (%u, %u, %u, %f, %f, %f, %f, %i)", character_id, zone_id, instance_id, x, y, z, heading, is_home); LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterBindPoint for character ID: %i zone_id: %u instance_id: %u x: %f y: %f z: %f heading: %f ishome: %u", character_id, zone_id, instance_id, x, y, z, heading, is_home); - auto results = QueryDatabase(query); if (!results.RowsAffected()){ std::cout << "ERROR Bind Home Save: " << results.ErrorMessage() << "\n\n" << query << "\n" << std::endl; } + auto results = QueryDatabase(query); + if (!results.RowsAffected()) { + LogFile->write(EQEMuLog::Debug, "ERROR Bind Home Save: %s. %s", results.ErrorMessage().c_str(), query.c_str()); + } ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterBindPoint", query); return true; } @@ -3234,7 +3240,6 @@ bool ZoneDatabase::SetCharacterFactionLevel(uint32 char_id, int32 faction_id, in bool ZoneDatabase::LoadFactionData() { - std::string query = "SELECT MAX(id) FROM faction_list"; auto results = QueryDatabase(query); if (!results.Success()) { @@ -3265,7 +3270,6 @@ bool ZoneDatabase::LoadFactionData() strn0cpy(faction_array[index]->name, row[1], 50); faction_array[index]->base = atoi(row[2]); - query = StringFormat("SELECT `mod`, `mod_name` FROM `faction_list_mod` WHERE faction_id = %u", index); auto modResults = QueryDatabase(query); if (!modResults.Success()) @@ -3273,8 +3277,9 @@ bool ZoneDatabase::LoadFactionData() for (auto modRow = modResults.begin(); modRow != modResults.end(); ++modRow) faction_array[index]->mods[modRow[1]] = atoi(modRow[0]); - } + + return true; } bool ZoneDatabase::GetFactionIdsForNPC(uint32 nfl_id, std::list *faction_list, int32* primary_faction) { diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 42d07810a..6ac85cff6 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -71,9 +71,11 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { break; case GateToBindPoint: target_zone_id = m_pp.binds[0].zoneId; + target_instance_id = m_pp.binds[0].instance_id; break; case ZoneToBindPoint: target_zone_id = m_pp.binds[0].zoneId; + target_instance_id = m_pp.binds[0].instance_id; break; case ZoneSolicited: //we told the client to zone somewhere, so we know where they are going. target_zone_id = zonesummon_id; @@ -717,20 +719,22 @@ void NPC::Gate() { Mob::Gate(); } -void Client::SetBindPoint(int to_zone, float new_x, float new_y, float new_z) { +void Client::SetBindPoint(int to_zone, int to_instance, float new_x, float new_y, float new_z) { if (to_zone == -1) { m_pp.binds[0].zoneId = zone->GetZoneID(); + m_pp.binds[0].instance_id = (zone->GetInstanceID() != 0 && zone->IsInstancePersistent()) ? zone->GetInstanceID() : 0; m_pp.binds[0].x = x_pos; m_pp.binds[0].y = y_pos; m_pp.binds[0].z = z_pos; } else { m_pp.binds[0].zoneId = to_zone; + m_pp.binds[0].instance_id = to_instance; m_pp.binds[0].x = new_x; m_pp.binds[0].y = new_y; m_pp.binds[0].z = new_z; } - database.SaveCharacterBindPoint(this->CharacterID(), m_pp.binds[0].zoneId, 0, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, 0, 0); + database.SaveCharacterBindPoint(this->CharacterID(), m_pp.binds[0].zoneId, m_pp.binds[0].instance_id, m_pp.binds[0].x, m_pp.binds[0].y, m_pp.binds[0].z, 0, 0); } void Client::GoToBind(uint8 bindnum) { @@ -741,13 +745,13 @@ void Client::GoToBind(uint8 bindnum) { // move the client, which will zone them if needed. // ignore restrictions on the zone request..? if(bindnum == 0) - MovePC(m_pp.binds[0].zoneId, 0.0f, 0.0f, 0.0f, 0.0f, 1, GateToBindPoint); + MovePC(m_pp.binds[0].zoneId, m_pp.binds[0].instance_id, 0.0f, 0.0f, 0.0f, 0.0f, 1, GateToBindPoint); else - MovePC(m_pp.binds[bindnum].zoneId, m_pp.binds[bindnum].x, m_pp.binds[bindnum].y, m_pp.binds[bindnum].z, m_pp.binds[bindnum].heading, 1); + MovePC(m_pp.binds[bindnum].zoneId, m_pp.binds[bindnum].instance_id, m_pp.binds[bindnum].x, m_pp.binds[bindnum].y, m_pp.binds[bindnum].z, m_pp.binds[bindnum].heading, 1); } void Client::GoToDeath() { - MovePC(m_pp.binds[0].zoneId, 0.0f, 0.0f, 0.0f, 0.0f, 1, ZoneToBindPoint); + MovePC(m_pp.binds[0].zoneId, m_pp.binds[0].instance_id, 0.0f, 0.0f, 0.0f, 0.0f, 1, ZoneToBindPoint); } void Client::SetZoneFlag(uint32 zone_id) {