diff --git a/changelog.txt b/changelog.txt index db0f9b7c9..42841800b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -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(, [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 diff --git a/zone/client.cpp b/zone/client.cpp index d546bbc6e..5bfc34f1a 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -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 @@ -813,8 +817,8 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s } - if(RuleB(QueryServ, PlayerChatLogging)){ - ServerPacket* pack = new ServerPacket(ServerOP_Speech, sizeof(Server_Speech_Struct)+strlen(message)+1); + if(RuleB(QueryServ, PlayerChatLogging)) { + ServerPacket* pack = new ServerPacket(ServerOP_Speech, sizeof(Server_Speech_Struct) + strlen(message) + 1); Server_Speech_Struct* sem = (Server_Speech_Struct*) pack->pBuffer; if(chan_num == 0) @@ -826,17 +830,23 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s sem->minstatus = this->Admin(); sem->type = chan_num; if(targetname != 0) - strcpy(sem->to,targetname); + strcpy(sem->to, targetname); if(GetName() != 0) - strcpy(sem->from,GetName()); - + strcpy(sem->from, GetName()); + pack->Deflate(); if(worldserver.Connected()) worldserver.SendPacket(pack); 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 @@ -850,7 +860,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s } case 2: { // GroupChat Raid* raid = entity_list.GetRaidByClient(this); - if(raid){ + if(raid) { raid->RaidGroupSay((const char*) message, this); break; } @@ -881,7 +891,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s { if(!global_channel_timer.Check()) { - if(strlen(targetname)==0) + if(strlen(targetname) == 0) ChannelMessageReceived(5, language, lang_skill, message, "discard"); //Fast typer or spammer?? else return; @@ -905,7 +915,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s if (!worldserver.SendChannelMessage(this, 0, 4, 0, language, message)) Message(0, "Error: World server disconnected"); } - else if(!RuleB(Chat, ServerWideAuction)){ + else if(!RuleB(Chat, ServerWideAuction)) { Mob *sender = this; if (GetPet() && GetPet()->FindType(SE_VoiceGraft)) @@ -920,8 +930,8 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s { if(!global_channel_timer.Check()) { - if(strlen(targetname)==0) - ChannelMessageReceived(5, language, lang_skill, message,"discard"); //Fast typer or spammer?? + if(strlen(targetname) == 0) + ChannelMessageReceived(5, language, lang_skill, message, "discard"); //Fast typer or spammer?? else return; } @@ -973,7 +983,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s case 7: { // Tell if(!global_channel_timer.Check()) { - if(strlen(targetname)==0) + if(strlen(targetname) == 0) ChannelMessageReceived(7, language, lang_skill, message, "discard"); //Fast typer or spammer?? else return; @@ -1020,12 +1030,12 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s } case 8: { // /say if(message[0] == COMMAND_CHAR) { - if(command_dispatch(this, message) == -2){ - if(RuleB(Chat, FlowCommandstoPerl_EVENT_SAY)){ - if(parse->PlayerHasQuestSub("EVENT_SAY")) { + if(command_dispatch(this, message) == -2) { + if(RuleB(Chat, FlowCommandstoPerl_EVENT_SAY)) { + if(parse->PlayerHasQuestSub("EVENT_SAY")) { parse->EventPlayer(EVENT_SAY, this, message, language); } - }else{ + } else { this->Message(13, "Command '%s' not recognized.", message); } } @@ -1051,9 +1061,9 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s if (GetTarget() != 0 && GetTarget()->IsNPC()) { if(!GetTarget()->CastToNPC()->IsEngaged()) { CheckLDoNHail(GetTarget()); - CheckEmoteHail(GetTarget(),message); + CheckEmoteHail(GetTarget(), message); - if(parse->HasQuestSub(GetTarget()->GetNPCTypeID(),"EVENT_SAY")){ + if(parse->HasQuestSub(GetTarget()->GetNPCTypeID(), "EVENT_SAY")){ if (DistNoRootNoZ(*GetTarget()) <= 200) { if(GetTarget()->CastToNPC()->IsMoving() && !GetTarget()->CastToNPC()->IsOnHatelist(GetTarget())) GetTarget()->CastToNPC()->PauseWandering(RuleI(NPC, SayPauseTimeInSec)); @@ -1075,7 +1085,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s } } else { - if(parse->HasQuestSub(GetTarget()->GetNPCTypeID(),"EVENT_AGGRO_SAY")) { + if(parse->HasQuestSub(GetTarget()->GetNPCTypeID(), "EVENT_AGGRO_SAY")) { if (DistNoRootNoZ(*GetTarget()) <= 200) { parse->EventNPC(EVENT_AGGRO_SAY, GetTarget()->CastToNPC(), this, message, language); } @@ -1100,13 +1110,12 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s char *Buffer = (char *)es; Buffer += 4; snprintf(Buffer, sizeof(Emote_Struct) - 4, "%s %s", GetName(), message); - entity_list.QueueCloseClients(this, outapp, true, 100,0,true,FilterSocials); + entity_list.QueueCloseClients(this, outapp, true, 100, 0, true, FilterSocials); safe_delete(outapp); - break; } default: { - Message(0, "Channel (%i) not implemented",(uint16)chan_num); + Message(0, "Channel (%i) not implemented", (uint16)chan_num); } } } @@ -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++) { diff --git a/zone/client.h b/zone/client.h index caae713e3..3ea8f364b 100644 --- a/zone/client.h +++ b/zone/client.h @@ -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, ...); diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 4f4bd4af2..d0f5249cf 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -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()) {