mirror of
https://github.com/EQEmu/Server.git
synced 2026-11-23 21:17:16 +00:00
Small fixes: Titanium overflow, LDoN/alt-currency sell-back, hover respawn, duels (#5127)
This commit is contained in:
1 parent
a572b03f56
commit
3c2c684c9d
8 files changed
+142
-18
No files matched your search
+51
-13
@@ -2315,12 +2315,9 @@ void Client::Handle_OP_AdventureMerchantSell(const EQApplicationPacket *app)
|
||||
}
|
||||
|
||||
// 06/11/2016 This formula matches RoF2 client side calculation.
|
||||
uint32 price = EQ::Clamp(
|
||||
price,
|
||||
EQ::ClampUpper(
|
||||
(item->LDoNPrice + 1) * item->LDoNSellBackRate / 100,
|
||||
item->LDoNPrice
|
||||
),
|
||||
// (clamping the uninitialised price itself could refund the full LDoNPrice)
|
||||
uint32 price = EQ::ClampUpper(
|
||||
(item->LDoNPrice + 1) * item->LDoNSellBackRate / 100,
|
||||
item->LDoNPrice
|
||||
);
|
||||
|
||||
@@ -2854,7 +2851,13 @@ void Client::Handle_OP_AltCurrencySell(const EQApplicationPacket *app)
|
||||
}
|
||||
|
||||
DeleteItemInInventory(sell->slot_id, sell->charges);
|
||||
cost *= sell->charges;
|
||||
// Handle_OP_AltCurrencyPurchase hands out MaxCharges units for one price, so a stack
|
||||
// sells back pro rata (multiply first so small prices don't truncate to 0)
|
||||
if (item->MaxCharges > 1) {
|
||||
cost = cost * sell->charges / item->MaxCharges;
|
||||
} else {
|
||||
cost *= sell->charges;
|
||||
}
|
||||
}
|
||||
|
||||
sell->cost = cost;
|
||||
@@ -6013,7 +6016,12 @@ void Client::Handle_OP_DuelDecline(const EQApplicationPacket *app)
|
||||
|
||||
Entity* entity = entity_list.GetID(ds->target_id);
|
||||
Entity* initiator = entity_list.GetID(ds->entity_id);
|
||||
if (!entity->IsClient() || !initiator->IsClient()) {
|
||||
if (!entity || !initiator || !entity->IsClient() || !initiator->IsClient()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// a decline must not cancel a duel that is already in progress
|
||||
if (entity->CastToClient()->IsDueling() || initiator->CastToClient()->IsDueling()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -6021,11 +6029,8 @@ void Client::Handle_OP_DuelDecline(const EQApplicationPacket *app)
|
||||
entity->CastToClient()->SetDueling(false);
|
||||
initiator->CastToClient()->SetDuelTarget(0);
|
||||
initiator->CastToClient()->SetDueling(false);
|
||||
if (GetID() == initiator->GetID()) {
|
||||
entity->CastToClient()->MessageString(Chat::NPCQuestSay, DUEL_DECLINE, initiator->GetName());
|
||||
} else {
|
||||
initiator->CastToClient()->MessageString(Chat::NPCQuestSay, DUEL_DECLINE, entity->GetName());
|
||||
}
|
||||
Client* other = (GetID() == initiator->GetID()) ? entity->CastToClient() : initiator->CastToClient();
|
||||
other->MessageString(Chat::NPCQuestSay, DUEL_DECLINE, GetName());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -13602,6 +13607,32 @@ void Client::Handle_OP_RequestDuel(const EQApplicationPacket *app)
|
||||
ds->duel_initiator = ds->duel_target;
|
||||
ds->duel_target = duel;
|
||||
Entity* entity = entity_list.GetID(ds->duel_target);
|
||||
if (!entity) {
|
||||
safe_delete(outapp);
|
||||
return;
|
||||
}
|
||||
|
||||
// The challenged player may answer with /duel, which sends OP_RequestDuel back to the challenger
|
||||
// (no OP_DuelAccept follows). Only the challenged side's request is an accept; the challenger
|
||||
// repeating /duel must not start the duel for the other player.
|
||||
if (
|
||||
GetID() != ds->duel_target &&
|
||||
entity->IsClient() &&
|
||||
!IsDueling() &&
|
||||
!entity->CastToClient()->IsDueling() &&
|
||||
!IsDuelChallenger() &&
|
||||
entity->CastToClient()->IsDuelChallenger() &&
|
||||
GetDuelTarget() == entity->GetID() &&
|
||||
entity->CastToClient()->GetDuelTarget() == GetID()
|
||||
) {
|
||||
safe_delete(outapp);
|
||||
EQApplicationPacket accept(OP_DuelAccept, sizeof(Duel_Struct));
|
||||
auto as = (Duel_Struct *) accept.pBuffer;
|
||||
as->duel_initiator = entity->GetID();
|
||||
as->duel_target = GetID();
|
||||
Handle_OP_DuelAccept(&accept);
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
GetID() != ds->duel_target &&
|
||||
@@ -13628,6 +13659,8 @@ void Client::Handle_OP_RequestDuel(const EQApplicationPacket *app)
|
||||
) {
|
||||
SetDuelTarget(ds->duel_target);
|
||||
entity->CastToClient()->SetDuelTarget(GetID());
|
||||
SetDuelChallenger(true);
|
||||
entity->CastToClient()->SetDuelChallenger(false);
|
||||
ds->duel_target = ds->duel_initiator;
|
||||
entity->CastToClient()->FastQueuePacket(&outapp);
|
||||
entity->CastToClient()->SetDueling(false);
|
||||
@@ -13662,6 +13695,11 @@ void Client::Handle_OP_RespawnWindow(const EQApplicationPacket *app)
|
||||
}
|
||||
char *Buffer = (char *)app->pBuffer;
|
||||
|
||||
// ignore repeat clicks after the player has already respawned
|
||||
if (!IsHoveringForRespawn()) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 Option = VARSTRUCT_DECODE_TYPE(uint32, Buffer);
|
||||
HandleRespawnFromHover(Option);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user