本文整理汇总了C++中RedSystemMessage函数的典型用法代码示例。如果您正苦于以下问题:C++ RedSystemMessage函数的具体用法?C++ RedSystemMessage怎么用?C++ RedSystemMessage使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RedSystemMessage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getSelectedUnit
bool ChatHandler::HandleCastSpellNECommand(const char* args, WorldSession *m_session)
{
Unit* caster = m_session->GetPlayer();
Unit* target = getSelectedUnit(m_session, false);
if(!target)
target = caster;
uint32 spellId = atol(args);
SpellEntry *spellentry = dbcSpell.LookupEntryForced(spellId);
if(spellentry == NULL)
{
RedSystemMessage(m_session, "Invalid spell id!");
return false;
}
BlueSystemMessage(m_session, "Casting spell %d on target.", spellId);
WorldPacket data;
data.Initialize( SMSG_SPELL_START );
data << caster->GetNewGUID();
data << caster->GetNewGUID();
data << spellId;
data << uint8(0);
data << uint16(0);
data << uint32(0);
data << uint16(2);
data << target->GetGUID();
m_session->SendPacket( &data );
data.clear();
data.Initialize( SMSG_SPELL_GO );
data << caster->GetNewGUID();
data << caster->GetNewGUID();
data << spellId;
data << uint8(0) << uint8(1) << uint8(1);
data << target->GetGUID();
data << uint8(0);
data << uint16(2);
data << target->GetGUID();
m_session->SendPacket( &data );
return true;
}
示例2: getSelectedChar
bool ChatHandler::CreateGuildCommand(const char* args, WorldSession *m_session)
{
if(!*args)
return false;
Player* ptarget = getSelectedChar(m_session);
if(ptarget == NULL)
return true;
if(strlen((char*)args)>75)
{
// send message to user
char buf[256];
snprintf((char*)buf,256,"The name was too long by %i", (unsigned int)strlen((char*)args)-75);
SystemMessage(m_session, buf);
return true;
}
for (uint32 i = 0; i < strlen(args); i++)
{
if(!isalpha(args[i]) && args[i]!=' ')
{
SystemMessage(m_session, "Error, name can only contain chars A-Z and a-z.");
return true;
}
}
GuildInfo* pGuild = guildmgr.GetGuildByGuildName(string(args));
if(pGuild)
{
RedSystemMessage(m_session, "Guild name is already taken.");
return true;
}
Charter tempCharter(0, ptarget->GetLowGUID(), CHARTER_TYPE_GUILD);
tempCharter.SignatureCount = 0;
tempCharter.GuildName = string(args);
guildmgr.CreateGuildFromCharter(&tempCharter);
SystemMessage(m_session, "Guild created");
return true;
}
示例3: RedSystemMessage
bool ChatHandler::HandleGODelete(const char *args, WorldSession *m_session)
{
GameObject *GObj = m_session->GetPlayer()->m_GM_SelectedGO;
if( !GObj )
{
RedSystemMessage(m_session, "No selected GameObject...");
return true;
}
if(GObj->m_spawn != 0)
{
uint32 cellx=float2int32(((_maxX-GObj->m_spawn->x)/_cellSize));
uint32 celly=float2int32(((_maxY-GObj->m_spawn->y)/_cellSize));
m_session->GetPlayer()->GetMapMgr()->GetBaseMap()->GetSpawnsListAndCreate(cellx,celly)->GOSpawns.erase(GObj->m_spawn);
delete GObj->m_spawn;
}
GObj->DeleteFromDB();
GObj->Despawn(0);
delete GObj;
m_session->GetPlayer()->m_GM_SelectedGO = 0;
/* std::stringstream sstext;
GameObject *GObj = m_session->GetPlayer()->m_GM_SelectedGO;
if( !GObj )
{
RedSystemMessage(m_session, "No selected GameObject...");
return true;
}
GObj->GetMapMgr()->GetBaseMap()->GetTemplate()->RemoveIndex<GameObject>(GObj); // remove index
GObj->Despawn(3600000);
GObj->DeleteFromDB();
sObjHolder.Delete<GameObject>(GObj);
m_session->GetPlayer()->m_GM_SelectedGO = NULL;
GreenSystemMessage(m_session, "GameObject successfully deleted from world and database !");
*/
return true;
}
示例4: RedSystemMessage
bool ChatHandler::HandleRecallAddCommand(const char* args, WorldSession *m_session)
{
if(!*args)
return false;
QueryResult *result = WorldDatabase.Query( "SELECT name FROM recall" );
if(!result)
return false;
do
{
Field *fields = result->Fetch();
const char * locname = fields[0].GetString();
if (strncmp((char*)args,locname,strlen(locname))==0)
{
RedSystemMessage(m_session, "Name in use, please use another name for your location.");
delete result;
return true;
}
}while (result->NextRow());
delete result;
Player* plr = m_session->GetPlayer();
std::stringstream ss;
string rc_locname = string(args);
ss << "INSERT INTO recall (name, mapid, positionX, positionY, positionZ) VALUES ('"
<< WorldDatabase.EscapeString(rc_locname).c_str() << "' , "
<< plr->GetMapId() << ", "
<< plr->GetPositionX() << ", "
<< plr->GetPositionY() << ", "
<< plr->GetPositionZ() << ");";
WorldDatabase.Execute( ss.str( ).c_str( ) );
char buf[256];
snprintf((char*)buf, 256, "Added location to DB with MapID: %d, X: %f, Y: %f, Z: %f",
(unsigned int)plr->GetMapId(), plr->GetPositionX(), plr->GetPositionY(), plr->GetPositionZ());
GreenSystemMessage(m_session, buf);
sGMLog.writefromsession(m_session, "used recall add, added \"%s\" location to database.", rc_locname.c_str());
return true;
}
示例5: RedSystemMessage
bool ChatHandler::HandleGMOnCommand(const char* args, WorldSession* m_session)
{
Player* _player = m_session->GetPlayer();
if(_player->HasFlag(PLAYER_FLAGS, PLAYER_FLAG_GM))
RedSystemMessage(m_session, "GM Flag is already set on.");
else
{
_player->SetFlag(PLAYER_FLAGS, PLAYER_FLAG_GM); // <GM>
_player->SetFaction(35);
_player->RemovePvPFlag();
_player->TriggerpassCheat = true;
BlueSystemMessage(m_session, "GM flag set.");
_player->UpdateVisibility();
}
return true;
}
示例6: RedSystemMessage
bool ChatHandler::HandleGOEnable(const char *args, WorldSession *m_session)
{
GameObject *GObj = m_session->GetPlayer()->GetSelectedGo();
if( !GObj )
{
RedSystemMessage(m_session, "No selected GameObject...");
return true;
}
if(GObj->GetUInt32Value(GAMEOBJECT_DYN_FLAGS) == 1)
{
// Deactivate
GObj->SetUInt32Value(GAMEOBJECT_DYN_FLAGS, 0);
} else {
// /Activate
GObj->SetUInt32Value(GAMEOBJECT_DYN_FLAGS, 1);
}
BlueSystemMessage(m_session, "Gameobject activate/deactivated.");
sGMLog.writefromsession( m_session, "activated/deactivated gameobject %s, entry %u", GameObjectNameStorage.LookupEntry( GObj->GetEntry() )->Name, GObj->GetEntry() );
return true;
}
示例7: GreenSystemMessage
bool ChatHandler::HandleGMOnCommand(const char* args, WorldSession* m_session)
{
GreenSystemMessage(m_session, "Setting GM Flag on yourself.");
Player* _player = m_session->GetPlayer();
if(_player->HasFlag(PLAYER_FLAGS, PLAYER_FLAG_GM))
RedSystemMessage(m_session, "GM Flag is already set on. Use .gm off to disable it.");
else
{
_player->SetFlag(PLAYER_FLAGS, PLAYER_FLAG_GM); // <GM>
_player->SetFaction(35);
_player->RemovePvPFlag();
BlueSystemMessage(m_session, "GM flag set. It will now appear above your name and in chat messages until you use .gm off.");
_player->UpdateVisibility();
}
return true;
}
示例8: getSelectedCreature
bool ChatHandler::HandleMonsterCastCommand(const char * args, WorldSession * m_session)
{
Unit* crt = getSelectedCreature(m_session, false);
if(crt == NULL)
{
RedSystemMessage(m_session, "Please select a creature before using this command.");
return true;
}
uint32 spellId = (uint32)atoi(args);
if(spellId == 0)
spellId = GetSpellIDFromLink( args );
SpellEntry * tmpsp = dbcSpell.LookupEntryForced(spellId);
if(tmpsp == NULL)
return false;
crt->CastSpell(reinterpret_cast<Unit*>(NULL), tmpsp, false);
sWorld.LogGM(m_session, "Used npc cast command on %s", crt->GetName());
return true;
}
示例9: RedSystemMessage
bool ChatHandler::HandleGOEnable(const char *args, WorldSession *m_session)
{
GameObject *GObj = NULL;
GObj = m_session->GetPlayer()->m_GM_SelectedGO;
if( !GObj )
{
RedSystemMessage(m_session, "No selected GameObject...");
return true;
}
if(GObj->GetUInt32Value(GAMEOBJECT_DYN_FLAGS) == 1)
{
// Deactivate
GObj->SetUInt32Value(GAMEOBJECT_DYN_FLAGS, 0);
} else {
// /Activate
GObj->SetUInt32Value(GAMEOBJECT_DYN_FLAGS, 1);
}
BlueSystemMessage(m_session, "Gameobject activate/deactivated.");
return true;
}
示例10: GreenSystemMessage
bool ChatHandler::HandleGMOnCommand(const char* args, WorldSession *m_session)
{
/*uint32 newbytes = m_session->GetPlayer( )->GetUInt32Value(PLAYER_BYTES_2) | 0x8;
m_session->GetPlayer( )->SetUInt32Value( PLAYER_BYTES_2, newbytes);
GreenSystemMessage(m_session, "GM Flag Set.");*/
if(m_session->GetPlayer()->bGMTagOn)
RedSystemMessage(m_session, "GM Status Is Already On. Use !gmoff To Disable It.");
else
{
m_session->GetPlayer()->setFaction(35);
m_session->GetPlayer()->GodModeCheat = true;
m_session->GetPlayer()->bInvincible = true;
m_session->GetPlayer()->bGMTagOn = true;
m_session->GetPlayer()->bCTagOn = true;
m_session->GetPlayer()->SetFlag(PLAYER_FLAGS, PLAYER_FLAG_GM); // <GM>
BlueSystemMessage(m_session, "GM Flag Set. It will appear above your name and in chat messages until you use !gmoff.");
}
return true;
}
示例11: ss
bool ChatHandler::HandleVehicleAddPassengerCommand(const char *args, WorldSession *session){
std::stringstream ss( args );
uint32 creature_entry;
ss >> creature_entry;
if( ss.fail() ){
RedSystemMessage( session, "You need to specify a creature id." );
return false;
}
if( session->GetPlayer()->GetTargetGUID() == 0 ){
RedSystemMessage( session, "You need to select a vehicle." );
return false;
}
Unit *u = session->GetPlayer()->GetMapMgr()->GetUnit( session->GetPlayer()->GetTargetGUID() );
if( u == NULL ){
RedSystemMessage( session, "You need to select a vehicle." );
return false;
}
if( u->GetVehicleComponent() == NULL ){
RedSystemMessage( session, "You need to select a vehicle." );
return false;
}
if( !u->GetVehicleComponent()->HasEmptySeat() ){
RedSystemMessage( session, "That vehicle has no more empty seats." );
return false;
}
CreatureInfo *ci = CreatureNameStorage.LookupEntry( creature_entry );
CreatureProto *cp = CreatureProtoStorage.LookupEntry( creature_entry );
if( ( ci == NULL ) || ( cp == NULL ) ){
RedSystemMessage( session, "Creature %u doesn't exist in the database", creature_entry );
return false;
}
Creature *c = u->GetMapMgr()->CreateCreature( creature_entry );
c->Load( cp, u->GetPositionX(), u->GetPositionY(), u->GetPositionZ(), u->GetOrientation() );
c->PushToWorld( u->GetMapMgr() );
c->EnterVehicle( u->GetGUID(), 1 );
return true;
}
示例12: sscanf
bool ChatHandler::HandleNpcSpawnLinkCommand(const char* args, WorldSession *m_session)
{
uint32 id;
char sql[512];
Creature* target = m_session->GetPlayer()->GetMapMgr()->GetCreature(GET_LOWGUID_PART(m_session->GetPlayer()->GetSelection()));
if (!target)
return false;
int valcount = sscanf(args, "%u", (unsigned int*)&id);
if (valcount)
{
snprintf(sql, 512, "UPDATE creature_spawns SET npc_respawn_link = '%u' WHERE id = '%u'", (unsigned int)id, (unsigned int)target->GetSQL_id());
WorldDatabase.Execute(sql);
BlueSystemMessage(m_session, "Spawn linking for this NPC has been updated: %u", id);
}
else
{
RedSystemMessage(m_session, "Sql entry invalid %u", id);
}
return true;
}
示例13: RedSystemMessage
bool ChatHandler::HandleModifySpeedCommand(const char* args, WorldSession *m_session)
{
WorldPacket data;
if (!*args)
return false;
float Speed = (float)atof((char*)args);
if (Speed > 255 || Speed < 1)
{
RedSystemMessage(m_session, "Incorrect value. Range is 1..255");
return true;
}
Player *chr = getSelectedChar(m_session);
if (chr == NULL)
return true;
if (chr != m_session->GetPlayer())
sGMLog.writefromsession(m_session, "modified speed of %s to %2.2f.", chr->GetName(), Speed);
char buf[256];
// send message to user
BlueSystemMessage(m_session, "You set the speed of %s to %2.2f.", chr->GetName(), Speed);
// send message to player
snprintf((char*)buf, 256, "%s set your speed to %2.2f.", m_session->GetPlayer()->GetName(), Speed);
SystemMessage(chr->GetSession(), buf);
chr->SetPlayerSpeed(RUN, Speed);
chr->SetPlayerSpeed(SWIM, Speed);
chr->SetPlayerSpeed(RUNBACK, Speed);
chr->SetPlayerSpeed(FLY, Speed);
return true;
}
示例14: getSelectedChar
bool ChatHandler::HandleResetAllInstancesCommand(const char* args, WorldSession* m_session)
{
Player* plr;
if (strlen(args) == 0)
plr = getSelectedChar(m_session, true);
else
plr = objmgr.GetPlayer(args, false);;
if (!plr)
{
RedSystemMessage(m_session, "Player not found");
return true;
}
SystemMessage(m_session, "Trying to reset all instances of player %s...", plr->GetName());
sInstanceMgr.ResetSavedInstances(plr);
SystemMessage(m_session, "...done");
sGMLog.writefromsession(m_session, "used reset all instances command on %s,", plr->GetName());
return true;
}
示例15: RedSystemMessage
bool ChatHandler::HandleDBItemSetBondingCommand(const char* args, WorldSession *m_session)
{
uint32 entry, subclass;
if(sscanf(args, "%u %u", &entry, &subclass) != 2)
return false;
ItemPrototype* proto = ItemPrototypeStorage.LookupEntry(entry);
if(proto == NULL)
{
RedSystemMessage(m_session, "Item does not exist.");
return true;
}
m_lock.Acquire();
BlueSystemMessage(m_session, "Changing item subclass from %u to %u", proto->SubClass, subclass);
proto->SubClass = subclass;
WorldDatabase.Execute("UPDATE items SET subclass = '%u' WHERE entry = '%u'", subclass, entry);
m_lock.Release();
m_session->SendItemInfo(entry);
return true;
}