diff --git a/changelog.txt b/changelog.txt index 083250403..eff2f9460 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 04/15/2014 == +Akkadius: Exported $client->SendMarqueeMessage(type, priority, fade_in, fade_out, duration, msg) - Will be available for simple plugin use +Akkadius: Exported $client->ExpeditionMessage(THIS, ExpdID, Message) - In use with custom expedition mod that will be released soon == 04/12/2014 == Kayen: Fixed an with the slow mitigation code that would cause it to spam the message. Optimized the way the variable is handled for slow mitigation. diff --git a/zone/client.cpp b/zone/client.cpp index 827a3f3f8..0f1314211 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -8213,3 +8213,30 @@ void Client::PlayMP3(const char* fname) QueuePacket(outapp); safe_delete(outapp); } + +void Client::ExpeditionSay(const char *str, int ExpID) { + char errbuf[MYSQL_ERRMSG_SIZE]; + char* query = 0; + MYSQL_RES *result; + MYSQL_ROW row; + + if (!database.RunQuery(query,MakeAnyLenString(&query, "SELECT `player_name` FROM `cust_inst_players` WHERE `inst_id` = %i", ExpID),errbuf,&result)){ + safe_delete_array(query); + return; + } + + safe_delete_array(query); + + if(result) + this->Message(14, "You say to the expedition, '%s'", str); + + while((row = mysql_fetch_row(result))) { + const char* CharName = row[0]; + if(strcmp(CharName, this->GetCleanName()) != 0) + worldserver.SendEmoteMessage(CharName, 0, 0, 14, "%s says to the expedition, '%s'", this->GetCleanName(), str); + // ChannelList->CreateChannel(ChannelName, ChannelOwner, ChannelPassword, true, atoi(row[3])); + } + + mysql_free_result(result); + +} \ No newline at end of file diff --git a/zone/client.h b/zone/client.h index 76b2c6774..87f085a44 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1170,6 +1170,7 @@ public: 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 Client::ExpeditionSay(const char *str, int ExpID); int mod_client_damage(int damage, SkillUseTypes skillinuse, int hand, const ItemInst* weapon, Mob* other); bool mod_client_message(char* message, uint8 chan_num); bool mod_can_increase_skill(SkillUseTypes skillid, Mob* against_who); diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index da81c03d7..0bab3cfb0 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -5898,6 +5898,64 @@ XS(XS_Client_PlayMP3) XSRETURN_EMPTY; } +XS(XS_Client_ExpeditionMessage); /* prototype to pass -Wmissing-prototypes */ +XS(XS_Client_ExpeditionMessage) +{ + dXSARGS; + if (items != 3) + Perl_croak(aTHX_ "Usage: Client::ExpeditionMessage(THIS, ExpdID, Message)"); + { + Client * THIS; + int ExpdID = (int)SvUV(ST(1)); + const char * Message = (const char *)SvPV_nolen(ST(2)); + dXSTARG; + + if (sv_derived_from(ST(0), "Client")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(Client *,tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type Client"); + if(THIS == NULL) + Perl_croak(aTHX_ "THIS is NULL, avoiding crash."); + + THIS->ExpeditionSay(Message, ExpdID); + } + XSRETURN_EMPTY; +} + +//Client::SendMarqueeMessage(uint32 type, uint32 priority, uint32 fade_in, uint32 fade_out, uint32 duration, std::string msg) + +XS(XS_Client_SendMarqueeMessage); /* prototype to pass -Wmissing-prototypes */ +XS(XS_Client_SendMarqueeMessage) +{ + dXSARGS; + if (items != 7) + Perl_croak(aTHX_ "Usage: Client::SendMarqueeMessage(THIS, type, priority, fade_in, fade_out, duration, msg)"); + { + Client * THIS; + uint32 type = (uint32)SvUV(ST(1)); + uint32 priority = (uint32)SvUV(ST(2)); + uint32 fade_in = (uint32)SvUV(ST(3)); + uint32 fade_out = (uint32)SvUV(ST(4)); + uint32 duration = (uint32)SvUV(ST(5)); + std::string msg = (std::string)SvPV_nolen(ST(6)); + dXSTARG; + + if (sv_derived_from(ST(0), "Client")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(Client *,tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type Client"); + if(THIS == NULL) + Perl_croak(aTHX_ "THIS is NULL, avoiding crash."); + + THIS->SendMarqueeMessage(type, priority, fade_in, fade_out, duration, msg); + } + XSRETURN_EMPTY; +} + #ifdef __cplusplus extern "C" #endif @@ -6134,6 +6192,8 @@ XS(boot_Client) newXSproto(strcpy(buf, "SilentMessage"), XS_Client_SilentMessage, file, "$$"); newXSproto(strcpy(buf, "PlayMP3"), XS_Client_PlayMP3, file, "$;$"); newXSproto(strcpy(buf, "SendTargetCommand"), XS_Client_SendTargetCommand, file, "$$"); + newXSproto(strcpy(buf, "ExpeditionMessage"), XS_Client_ExpeditionMessage, file, "$$$"); + newXSproto(strcpy(buf, "SendMarqueeMessage"), XS_Client_SendMarqueeMessage, file, "$$$$$$$"); XSRETURN_YES; }