Forum > Serverside Modding
[C++] [QUESTION] Text/Emotes give experience?
(1/1)
Nic:
Hello,
I've seen, it give an possibility, to give players experience points per punctuation mark.
For example:
Player1 say: Hello Friends Player1 get 120 Experience Points
(10 Points per punctuation mark. The Player get experience in /say /emote)
Player1 [GUILD]: Hello Player1 get 0 Experience Points
(The Player get no experience in /1 /2 /3 /4 /g /raid /p)
Can someone help me?
schlumpf:
Hook Chat-Events. Depending on the channel, parse the message and award experience. Should be an easy script.
Nic:
Schlumpf write a nice script, but the script is to old for Trinity Core Rev. 7331 (3.2.2a). I try to edit the script, but i havent success.
Can someone help me by the Script editing?
--- Code: ---/* * Copyright (C) 2010 schlumpf */
#include "ScriptPCH.h" #include "Channel.h" #include "Player.h"
class Guild; class Group;
class ChatXPScript : public PlayerScript { public: ChatXPScript() : PlayerScript("ChatXPScript") { }
void OnChat(Player* player, uint32 type, uint32 /*lang*/, std::string msg) // CHAT_MSG_ADDON, CHAT_MSG_SAY, CHAT_MSG_EMOTE, CHAT_MSG_YELL { if( type == CHAT_MSG_EMOTE ) return; if( type == CHAT_MSG_ADDON ) return; int xpGain = 10; // modify: xpGain += msg.length(); player->GiveXP( xpGain, NULL, 1.0f ); }
void OnChat(Player *player, uint32 /*type*/, uint32 /*lang*/, std::string msg, Player *receiver) // CHAT_MSG_WHISPER { int xpGain1 = 5; int xpGain2 = 2; // modify: xpGain1 *= msg.length(); xpGain2 *= msg.length(); player->GiveXP( xpGain1, NULL, 1.0f ); receiver->GiveXP( xpGain2, NULL, 1.0f ); }
void OnChat(Player *player, uint32 type, uint32 /*lang*/, std::string msg, Group */*group*/) // CHAT_MSG_PARTY, CHAT_MSG_PARTY_LEADER, CHAT_MSG_RAID, CHAT_MSG_RAID_LEADER, CHAT_MSG_RAID_WARNING, CHAT_MSG_BATTLEGROUND, CHAT_MSG_BATTLEGROUND_LEADER { if( type == CHAT_MSG_PARTY ) return; if( type == CHAT_MSG_RAID ) return; if( type == CHAT_MSG_BATTLEGROUND ) return; int xpGain = 100; // modify: xpGain += msg.length(); player->GiveXP( xpGain, NULL, 1.0f ); }
void OnChat(Player *player, uint32 /*type*/, uint32 /*lang*/, std::string msg, Guild */*guild*/) // CHAT_MSG_GUILD, CHAT_MSG_OFFICER { if( type == CHAT_MSG_OFFICER ) return; int xpGain = 10; // modify: xpGain += msg.length(); player->GiveXP( xpGain, NULL, 1.0f ); }
void OnChat(Player *player, uint32 /*type*/, uint32 /*lang*/, std::string msg, Channel *channel) { if( !channel ) return; if( channel->HasFlag(CHANNEL_FLAG_TRADE) ) return; if( channel->HasFlag(CHANNEL_FLAG_LFG) ) return; int xpGain = 0; // modify: xpGain += msg.length(); player->GiveXP( xpGain, NULL, 1.0f ); } };
void AddSC_ChatXPScript() { new ChatXPScript(); } --- End code ---
Navigation
[0] Message Index
|