Chat garbled for drunk characters.

This commit is contained in:
joligario 2013-02-17 23:38:51 -05:00 committed by JJ
parent a41874b6a7
commit 3feeced884
4 changed files with 40 additions and 40 deletions

View File

@ -10,6 +10,7 @@ OPTIONAL SQL: Re-run utils/sql/svn/merc.sql for latest spell lists.
Derision: Added optional guildid and minstatus parameters to quest::gmsay(<messsage>, [color], [toworld], [guildid], [minstatus])
Derision: Client version is now returned by the stream proxy as a number.
Derision: Fixed bug where BecomeTrader packets were only being sent to the Trader, not all other clients in the bazaar.
JJ: Chat garbled for drunk characters.
== 02/16/2013 ==
demonstar55: Fix AA reuse timer calc

View File

@ -758,7 +758,11 @@ void Client::FastQueuePacket(EQApplicationPacket** app, bool ack_req, CLIENT_CON
return;
}
void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_skill, const char* message, const char* targetname) {
void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_skill, const char* orig_message, const char* targetname) {
char message[4096];
strcpy(message, orig_message);
#if EQDEBUG >= 11
LogFile->write(EQEMuLog::Debug,"Client::ChannelMessageReceived() Channel:%i message:'%s'", chan_num, message);
#endif
@ -837,6 +841,12 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
safe_delete(pack);
}
// Garble the message based on drunkness
if (m_pp.intoxication > 0) {
GarbleMessage(message, (int)(m_pp.intoxication / 3));
language = 0; // No need for language when drunk
}
switch(chan_num)
{
case 0: { // GuildChat
@ -1102,7 +1112,6 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
snprintf(Buffer, sizeof(Emote_Struct) - 4, "%s %s", GetName(), message);
entity_list.QueueCloseClients(this, outapp, true, 100, 0, true, FilterSocials);
safe_delete(outapp);
break;
}
default: {
@ -7274,6 +7283,7 @@ void Client::DuplicateLoreMessage(uint32 ItemID)
void Client::GarbleMessage(char *message, uint8 variance)
{
// Garble message by variance%
const char alpha_list[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; // only change alpha characters for now
for (size_t i = 0; i < strlen(message); i++) {

View File

@ -256,7 +256,7 @@ public:
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* message, const char* targetname=NULL);
void ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_skill, const char* orig_message, const char* targetname=NULL);
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, ...);

View File

@ -717,7 +717,7 @@ bool Client::Process() {
#ifdef REVERSE_AGGRO
//At this point, we are still connected, everything important has taken
//place, now check to see if anybody wants to aggro us.
// Everhood 6/15/06 - only if client is not feigned
// only if client is not feigned
if(ret && !GetFeigned() && scanarea_timer.Check()) {
entity_list.CheckClientAggro(this);
}
@ -775,7 +775,7 @@ bool Client::Process() {
}
OnDisconnect(true);
}
// EverHood Feign Death 2 minutes and zone forgets you
// Feign Death 2 minutes and zone forgets you
if (forget_timer.Check()) {
forget_timer.Disable();
entity_list.ClearZoneFeignAggro(this);
@ -1339,7 +1339,7 @@ void Client::OPMoveCoin(const EQApplicationPacket* app)
{
case -1: // destroy
{
// solar: I don't think you can move coin from the void,
// I don't think you can move coin from the void,
// but need to check this
break;
}
@ -1532,7 +1532,7 @@ void Client::OPMoveCoin(const EQApplicationPacket* app)
// don't allow them to go into negatives (from our point of view)
amount_to_take = *from_bucket < mc->amount ? *from_bucket : mc->amount;
// solar: if you move 11 gold into a bank platinum location, the packet
// if you move 11 gold into a bank platinum location, the packet
// will say 11, but the client will have 1 left on their cursor, so we have
// to figure out the conversion ourselves
@ -1542,14 +1542,10 @@ void Client::OPMoveCoin(const EQApplicationPacket* app)
// we have to adjust the amount we take as well
amount_to_take = amount_to_add * ((float)CoinTypeCoppers(mc->cointype2) / (float)CoinTypeCoppers(mc->cointype1));
// solar: now we should have a from_bucket, a to_bucket, an amount_to_take
// now we should have a from_bucket, a to_bucket, an amount_to_take
// and an amount_to_add
#ifdef SOLAR
printf("taking %d coins, adding %d coins\n", amount_to_take, amount_to_add);
#endif
// solar: now we actually take it from the from bucket. if there's an error
// now we actually take it from the from bucket. if there's an error
// with the destination slot, they lose their money
*from_bucket -= amount_to_take;
// why are intentionally inducing a crash here rather than letting the code attempt to stumble on?
@ -1573,13 +1569,6 @@ void Client::OPMoveCoin(const EQApplicationPacket* app)
}
}
#ifdef SOLAR
printf("from bucket = %d ", *from_bucket);
if(to_bucket)
printf("to bucket = %d", *to_bucket);
printf("\n");
#endif
// if this is a trade move, inform the person being traded with
if(mc->to_slot == 3 && trader && trader->IsClient())
{