mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-18 19:41:30 +00:00
Fix for potential recursive loops if using RemoveFromHateList() within EVENT_HATE_LIST.
Some work on Bazaar searching, but not functional yet.
This commit is contained in:
parent
414db873b7
commit
3b45a66498
@ -1,5 +1,8 @@
|
|||||||
EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
|
== 02/18/2015 ==
|
||||||
|
Trevius: Fix for potential recursive loops if using RemoveFromHateList() within EVENT_HATE_LIST.
|
||||||
|
|
||||||
== 02/17/2015 ==
|
== 02/17/2015 ==
|
||||||
Uleat: Implemented per-client character creation limiting. Caps are unknown atm..so, don't get over-zealous!
|
Uleat: Implemented per-client character creation limiting. Caps are unknown atm..so, don't get over-zealous!
|
||||||
Notes:
|
Notes:
|
||||||
|
|||||||
@ -2776,7 +2776,8 @@ struct BazaarWelcome_Struct {
|
|||||||
BazaarWindowStart_Struct Beginning;
|
BazaarWindowStart_Struct Beginning;
|
||||||
uint32 Traders;
|
uint32 Traders;
|
||||||
uint32 Items;
|
uint32 Items;
|
||||||
uint8 Unknown012[8];
|
uint32 Unknown012;
|
||||||
|
uint32 Unknown016;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BazaarSearch_Struct {
|
struct BazaarSearch_Struct {
|
||||||
@ -3207,7 +3208,7 @@ struct TraderDelItem_Struct{
|
|||||||
|
|
||||||
struct TraderClick_Struct{
|
struct TraderClick_Struct{
|
||||||
/*000*/ uint32 TraderID;
|
/*000*/ uint32 TraderID;
|
||||||
/*004*/ uint32 Unknown004;
|
/*004*/ uint32 Code;
|
||||||
/*008*/ uint32 Unknown008;
|
/*008*/ uint32 Unknown008;
|
||||||
/*012*/ uint32 Approval;
|
/*012*/ uint32 Approval;
|
||||||
/*016*/
|
/*016*/
|
||||||
|
|||||||
@ -3667,6 +3667,23 @@ namespace RoF2
|
|||||||
|
|
||||||
FINISH_ENCODE();
|
FINISH_ENCODE();
|
||||||
}
|
}
|
||||||
|
else if (psize == sizeof(BazaarWelcome_Struct))
|
||||||
|
{
|
||||||
|
ENCODE_LENGTH_EXACT(BazaarWelcome_Struct);
|
||||||
|
SETUP_DIRECT_ENCODE(BazaarWelcome_Struct, structs::BazaarWelcome_Struct);
|
||||||
|
|
||||||
|
eq->Code = emu->Beginning.Action;
|
||||||
|
eq->EntityID = emu->Unknown012;
|
||||||
|
OUT(Traders);
|
||||||
|
OUT(Items);
|
||||||
|
eq->Traders2 = emu->Traders;
|
||||||
|
eq->Items2 = emu->Items;
|
||||||
|
|
||||||
|
Log.Out(Logs::Detail, Logs::Trading, "ENCODE(OP_TraderShop): BazaarWelcome_Struct Code %d, Traders %d, Items %d",
|
||||||
|
eq->Code, eq->Traders, eq->Items);
|
||||||
|
|
||||||
|
FINISH_ENCODE();
|
||||||
|
}
|
||||||
else if (psize == sizeof(TraderBuy_Struct))
|
else if (psize == sizeof(TraderBuy_Struct))
|
||||||
{
|
{
|
||||||
ENCODE_LENGTH_EXACT(TraderBuy_Struct);
|
ENCODE_LENGTH_EXACT(TraderBuy_Struct);
|
||||||
@ -5009,8 +5026,25 @@ namespace RoF2
|
|||||||
DECODE_LENGTH_EXACT(structs::TraderClick_Struct);
|
DECODE_LENGTH_EXACT(structs::TraderClick_Struct);
|
||||||
SETUP_DIRECT_DECODE(TraderClick_Struct, structs::TraderClick_Struct);
|
SETUP_DIRECT_DECODE(TraderClick_Struct, structs::TraderClick_Struct);
|
||||||
|
|
||||||
|
IN(Code);
|
||||||
IN(TraderID);
|
IN(TraderID);
|
||||||
IN(Approval);
|
IN(Approval);
|
||||||
|
Log.Out(Logs::Detail, Logs::Trading, "DECODE(OP_TraderShop): TraderClick_Struct Code %d, TraderID %d, Approval %d",
|
||||||
|
eq->Code, eq->TraderID, eq->Approval);
|
||||||
|
|
||||||
|
FINISH_DIRECT_DECODE();
|
||||||
|
}
|
||||||
|
else if (psize == sizeof(structs::BazaarWelcome_Struct))
|
||||||
|
{
|
||||||
|
// Don't think this size gets used in RoF+ - Leaving for now...
|
||||||
|
DECODE_LENGTH_EXACT(structs::BazaarWelcome_Struct);
|
||||||
|
SETUP_DIRECT_DECODE(BazaarWelcome_Struct, structs::BazaarWelcome_Struct);
|
||||||
|
|
||||||
|
emu->Beginning.Action = eq->Code;
|
||||||
|
IN(Traders);
|
||||||
|
IN(Items);
|
||||||
|
Log.Out(Logs::Detail, Logs::Trading, "DECODE(OP_TraderShop): BazaarWelcome_Struct Code %d, Traders %d, Items %d",
|
||||||
|
eq->Code, eq->Traders, eq->Items);
|
||||||
|
|
||||||
FINISH_DIRECT_DECODE();
|
FINISH_DIRECT_DECODE();
|
||||||
}
|
}
|
||||||
@ -5026,9 +5060,9 @@ namespace RoF2
|
|||||||
memcpy(emu->ItemName, eq->ItemName, sizeof(emu->ItemName));
|
memcpy(emu->ItemName, eq->ItemName, sizeof(emu->ItemName));
|
||||||
IN(ItemID);
|
IN(ItemID);
|
||||||
IN(Quantity);
|
IN(Quantity);
|
||||||
Log.Out(Logs::Detail, Logs::Trading, "DECODE(OP_TraderShop): (Unknowns) Unknown004 %d, Unknown008 %d, Unknown012 %d, Unknown076 %d, Unknown276 %d",
|
Log.Out(Logs::Detail, Logs::Trading, "DECODE(OP_TraderShop): TraderBuy_Struct (Unknowns) Unknown004 %d, Unknown008 %d, Unknown012 %d, Unknown076 %d, Unknown276 %d",
|
||||||
eq->Unknown004, eq->Unknown008, eq->Unknown012, eq->Unknown076, eq->Unknown276);
|
eq->Unknown004, eq->Unknown008, eq->Unknown012, eq->Unknown076, eq->Unknown276);
|
||||||
Log.Out(Logs::Detail, Logs::Trading, "DECODE(OP_TraderShop): Buy Action %d, Price %d, Trader %d, ItemID %d, Quantity %d, ItemName, %s",
|
Log.Out(Logs::Detail, Logs::Trading, "DECODE(OP_TraderShop): TraderBuy_Struct Buy Action %d, Price %d, Trader %d, ItemID %d, Quantity %d, ItemName, %s",
|
||||||
eq->Action, eq->Price, eq->TraderID, eq->ItemID, eq->Quantity, eq->ItemName);
|
eq->Action, eq->Price, eq->TraderID, eq->ItemID, eq->Quantity, eq->ItemName);
|
||||||
|
|
||||||
FINISH_DIRECT_DECODE();
|
FINISH_DIRECT_DECODE();
|
||||||
|
|||||||
@ -2940,10 +2940,12 @@ struct BazaarWindowStart_Struct {
|
|||||||
|
|
||||||
|
|
||||||
struct BazaarWelcome_Struct {
|
struct BazaarWelcome_Struct {
|
||||||
BazaarWindowStart_Struct Beginning;
|
uint32 Code;
|
||||||
uint32 Traders;
|
uint32 EntityID;
|
||||||
uint32 Items;
|
uint32 Traders;
|
||||||
uint8 Unknown012[8];
|
uint32 Items;
|
||||||
|
uint32 Traders2;
|
||||||
|
uint32 Items2;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BazaarSearch_Struct {
|
struct BazaarSearch_Struct {
|
||||||
|
|||||||
@ -13516,49 +13516,68 @@ void Client::Handle_OP_TraderShop(const EQApplicationPacket *app)
|
|||||||
|
|
||||||
if (app->size == sizeof(TraderClick_Struct))
|
if (app->size == sizeof(TraderClick_Struct))
|
||||||
{
|
{
|
||||||
// This is when a potential purchaser right clicks on this client who is in Trader mode to
|
|
||||||
// browse their goods.
|
|
||||||
TraderClick_Struct* tcs = (TraderClick_Struct*)app->pBuffer;
|
TraderClick_Struct* tcs = (TraderClick_Struct*)app->pBuffer;
|
||||||
|
|
||||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_TraderShop, sizeof(TraderClick_Struct));
|
Log.Out(Logs::Detail, Logs::Trading, "Handle_OP_TraderShop: TraderClick_Struct TraderID %d, Code %d, Unknown008 %d, Approval %d",
|
||||||
|
tcs->TraderID, tcs->Code, tcs->Unknown008, tcs->Approval);
|
||||||
|
|
||||||
TraderClick_Struct* outtcs = (TraderClick_Struct*)outapp->pBuffer;
|
if (tcs->Code == BazaarWelcome)
|
||||||
|
|
||||||
Client* Trader = entity_list.GetClientByID(tcs->TraderID);
|
|
||||||
|
|
||||||
if (Trader)
|
|
||||||
{
|
{
|
||||||
outtcs->Approval = Trader->WithCustomer(GetID());
|
Log.Out(Logs::Detail, Logs::Trading, "Client::Handle_OP_TraderShop: Sent Bazaar Welcome Info");
|
||||||
Log.Out(Logs::Detail, Logs::Trading, "Client::Handle_OP_TraderShop: Shop Request (%s) to (%s) with Approval: %d", GetCleanName(), Trader->GetCleanName(), outtcs->Approval);
|
SendBazaarWelcome();
|
||||||
}
|
|
||||||
else {
|
|
||||||
Log.Out(Logs::Detail, Logs::Trading, "Client::Handle_OP_TraderShop: entity_list.GetClientByID(tcs->traderid)"
|
|
||||||
" returned a nullptr pointer");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
outtcs->TraderID = tcs->TraderID;
|
|
||||||
|
|
||||||
outtcs->Unknown008 = 0x3f800000;
|
|
||||||
|
|
||||||
QueuePacket(outapp);
|
|
||||||
|
|
||||||
|
|
||||||
if (outtcs->Approval) {
|
|
||||||
this->BulkSendTraderInventory(Trader->CharacterID());
|
|
||||||
Trader->Trader_CustomerBrowsing(this);
|
|
||||||
TraderID = tcs->TraderID;
|
|
||||||
Log.Out(Logs::Detail, Logs::Trading, "Client::Handle_OP_TraderShop: Trader Inventory Sent");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Message_StringID(clientMessageYellow, TRADER_BUSY);
|
// This is when a potential purchaser right clicks on this client who is in Trader mode to
|
||||||
Log.Out(Logs::Detail, Logs::Trading, "Client::Handle_OP_TraderShop: Trader Busy");
|
// browse their goods.
|
||||||
|
EQApplicationPacket* outapp = new EQApplicationPacket(OP_TraderShop, sizeof(TraderClick_Struct));
|
||||||
|
|
||||||
|
TraderClick_Struct* outtcs = (TraderClick_Struct*)outapp->pBuffer;
|
||||||
|
|
||||||
|
Client* Trader = entity_list.GetClientByID(tcs->TraderID);
|
||||||
|
|
||||||
|
if (Trader)
|
||||||
|
{
|
||||||
|
outtcs->Approval = Trader->WithCustomer(GetID());
|
||||||
|
Log.Out(Logs::Detail, Logs::Trading, "Client::Handle_OP_TraderShop: Shop Request (%s) to (%s) with Approval: %d", GetCleanName(), Trader->GetCleanName(), outtcs->Approval);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Log.Out(Logs::Detail, Logs::Trading, "Client::Handle_OP_TraderShop: entity_list.GetClientByID(tcs->traderid)"
|
||||||
|
" returned a nullptr pointer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
outtcs->TraderID = tcs->TraderID;
|
||||||
|
|
||||||
|
outtcs->Unknown008 = 0x3f800000;
|
||||||
|
|
||||||
|
QueuePacket(outapp);
|
||||||
|
|
||||||
|
|
||||||
|
if (outtcs->Approval) {
|
||||||
|
this->BulkSendTraderInventory(Trader->CharacterID());
|
||||||
|
Trader->Trader_CustomerBrowsing(this);
|
||||||
|
TraderID = tcs->TraderID;
|
||||||
|
Log.Out(Logs::Detail, Logs::Trading, "Client::Handle_OP_TraderShop: Trader Inventory Sent");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Message_StringID(clientMessageYellow, TRADER_BUSY);
|
||||||
|
Log.Out(Logs::Detail, Logs::Trading, "Client::Handle_OP_TraderShop: Trader Busy");
|
||||||
|
}
|
||||||
|
|
||||||
|
safe_delete(outapp);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
safe_delete(outapp);
|
}
|
||||||
|
else if (app->size == sizeof(BazaarWelcome_Struct))
|
||||||
return;
|
{
|
||||||
|
// RoF+
|
||||||
|
// Client requested Bazaar Welcome Info (Trader and Item Total Counts)
|
||||||
|
SendBazaarWelcome();
|
||||||
|
Log.Out(Logs::Detail, Logs::Trading, "Client::Handle_OP_TraderShop: Sent Bazaar Welcome Info");
|
||||||
}
|
}
|
||||||
else if (app->size == sizeof(TraderBuy_Struct))
|
else if (app->size == sizeof(TraderBuy_Struct))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -219,17 +219,17 @@ bool HateList::RemoveEntFromHateList(Mob *in_entity)
|
|||||||
{
|
{
|
||||||
if ((*iterator)->entity_on_hatelist == in_entity)
|
if ((*iterator)->entity_on_hatelist == in_entity)
|
||||||
{
|
{
|
||||||
if (in_entity)
|
|
||||||
parse->EventNPC(EVENT_HATE_LIST, hate_owner->CastToNPC(), in_entity, "0", 0);
|
|
||||||
is_found = true;
|
is_found = true;
|
||||||
|
|
||||||
|
|
||||||
if (in_entity && in_entity->IsClient())
|
if (in_entity && in_entity->IsClient())
|
||||||
in_entity->CastToClient()->DecrementAggroCount();
|
in_entity->CastToClient()->DecrementAggroCount();
|
||||||
|
|
||||||
delete (*iterator);
|
delete (*iterator);
|
||||||
iterator = list.erase(iterator);
|
iterator = list.erase(iterator);
|
||||||
|
|
||||||
|
if (in_entity)
|
||||||
|
parse->EventNPC(EVENT_HATE_LIST, hate_owner->CastToNPC(), in_entity, "0", 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
++iterator;
|
++iterator;
|
||||||
|
|||||||
@ -1558,18 +1558,7 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs, Client* Trader, const EQApplic
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EQApplicationPacket* outapp = nullptr;
|
EQApplicationPacket* outapp = new EQApplicationPacket(OP_Trader, sizeof(TraderBuy_Struct));
|
||||||
|
|
||||||
if (Trader->GetClientVersion() >= ClientVersion::RoF)
|
|
||||||
{
|
|
||||||
//outapp = new EQApplicationPacket(OP_TraderShop, sizeof(TraderBuy_Struct));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//outapp = new EQApplicationPacket(OP_Trader, sizeof(TraderBuy_Struct));
|
|
||||||
}
|
|
||||||
|
|
||||||
outapp = new EQApplicationPacket(OP_Trader, sizeof(TraderBuy_Struct));
|
|
||||||
|
|
||||||
TraderBuy_Struct* outtbs = (TraderBuy_Struct*)outapp->pBuffer;
|
TraderBuy_Struct* outtbs = (TraderBuy_Struct*)outapp->pBuffer;
|
||||||
|
|
||||||
@ -1701,7 +1690,15 @@ void Client::SendBazaarWelcome()
|
|||||||
if (results.Success() && results.RowCount() == 1){
|
if (results.Success() && results.RowCount() == 1){
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
|
|
||||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_BazaarSearch, sizeof(BazaarWelcome_Struct));
|
EQApplicationPacket* outapp = nullptr;
|
||||||
|
if (GetClientVersion() >= ClientVersion::RoF)
|
||||||
|
{
|
||||||
|
outapp = new EQApplicationPacket(OP_TraderShop, sizeof(BazaarWelcome_Struct));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
outapp = new EQApplicationPacket(OP_BazaarSearch, sizeof(BazaarWelcome_Struct));
|
||||||
|
}
|
||||||
|
|
||||||
memset(outapp->pBuffer,0,outapp->size);
|
memset(outapp->pBuffer,0,outapp->size);
|
||||||
|
|
||||||
@ -1712,6 +1709,11 @@ void Client::SendBazaarWelcome()
|
|||||||
bws->Traders = atoi(row[0]);
|
bws->Traders = atoi(row[0]);
|
||||||
bws->Items = atoi(row[1]);
|
bws->Items = atoi(row[1]);
|
||||||
|
|
||||||
|
if (GetClientVersion() >= ClientVersion::RoF)
|
||||||
|
{
|
||||||
|
bws->Unknown012 = GetID();
|
||||||
|
}
|
||||||
|
|
||||||
QueuePacket(outapp);
|
QueuePacket(outapp);
|
||||||
|
|
||||||
safe_delete(outapp);
|
safe_delete(outapp);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user