本文整理汇总了C++中WorldSession::GetTrinityString方法的典型用法代码示例。如果您正苦于以下问题:C++ WorldSession::GetTrinityString方法的具体用法?C++ WorldSession::GetTrinityString怎么用?C++ WorldSession::GetTrinityString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorldSession
的用法示例。
在下文中一共展示了WorldSession::GetTrinityString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnGossipHello
bool OnGossipHello(Player* player, Creature* creature)
{
WorldSession* session = player->GetSession();
for (uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_TABARD; slot++) // EQUIPMENT_SLOT_END
{
if (Item* newItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
{
if (sTransmogrification->AllowedQuality(newItem->GetTemplate()->Quality))
{
if (const char* slotName = GetSlotName(slot, session))
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, slotName, EQUIPMENT_SLOT_END, slot);
}
}
}
player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_INTERACT_1, session->GetTrinityString(LANG_OPTION_REMOVE_ALL), EQUIPMENT_SLOT_END+2, 0, session->GetTrinityString(LANG_POPUP_REMOVE_ALL), 0, false);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, session->GetTrinityString(LANG_OPTION_UPDATE_MENU), EQUIPMENT_SLOT_END+1, 0);
player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
return true;
}
示例2: SendNameQueryOpcodeFromDBCallBack
void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult *result, uint32 accountId)
{
if(!result)
return;
WorldSession * session = sWorld.FindSession(accountId);
if(!session)
{
delete result;
return;
}
Field *fields = result->Fetch();
uint32 guid = fields[0].GetUInt32();
std::string name = fields[1].GetCppString();
uint8 pRace = 0, pGender = 0, pClass = 0;
if(name == "")
name = session->GetTrinityString(LANG_NON_EXIST_CHARACTER);
else
{
pRace = fields[2].GetUInt8();
pGender = fields[3].GetUInt8();
pClass = fields[4].GetUInt8();
}
// guess size
WorldPacket data( SMSG_NAME_QUERY_RESPONSE, (8+1+1+1+1+1+1+10) );
data.appendPackGUID(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER));
data << uint8(0); // added in 3.1
data << name;
data << uint8(0); // realm name for cross realm BG usage
data << uint8(pRace); // race
data << uint8(pGender); // gender
data << uint8(pClass); // class
// if the first declined name field (5) is empty, the rest must be too
if(sWorld.getConfig(CONFIG_DECLINED_NAMES_USED) && fields[5].GetCppString() != "")
{
data << uint8(1); // is declined
for (int i = 5; i < MAX_DECLINED_NAME_CASES+5; ++i)
data << fields[i].GetCppString();
}
else
data << uint8(0); // is not declined
session->SendPacket( &data );
delete result;
}
示例3: HandleRanksDisplayCommand
static bool HandleRanksDisplayCommand(ChatHandler* handler, char const* args)
{
if (*args)
return false;
WorldSession* session = handler->GetSession();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_RANKS_INFO);
stmt->setUInt32(0, GUID_LOPART(handler->GetSession()->GetPlayer()->GetGUID()));
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
return false;
uint32 team = result->Fetch()[0].GetUInt32();
uint32 rank = result->Fetch()[1].GetUInt32();
uint32 total = result->Fetch()[2].GetUInt32();
uint32 last = result->Fetch()[3].GetUInt32();
uint32 points = floor(10*sqrt((float)total/10)+last);
handler->PSendSysMessage(LANG_RANKS_INFO_COMMAND, session->GetTrinityString(LANG_RANKS_NAME+rank+6*(team==67)));
handler->PSendSysMessage(LANG_RANKS_INFO_COMMAND+1, last, total);
if (rank != 6)
handler->PSendSysMessage(LANG_RANKS_INFO_COMMAND+2, points, PvpPointsFloor[rank]);
else
handler->PSendSysMessage(LANG_RANKS_INFO_COMMAND+3, points);
return true;
}
示例4: OnGossipSelect
bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 uiAction)
{
WorldSession* session = player->GetSession();
player->PlayerTalkClass->ClearMenus();
switch(sender)
{
case EQUIPMENT_SLOT_END: // Show items you can use
{
if (Item* oldItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, uiAction))
{
uint32 lowGUID = player->GetGUIDLow();
_items[lowGUID].clear();
uint32 limit = 0;
uint32 price = 0;
switch (sTransmogrification->GetRequireGold())
{
case 1: { price = (unsigned int)(GetFakePrice(oldItem)*sTransmogrification->GetGoldModifier()); } break;
case 2: { price = (unsigned int)sTransmogrification->GetGoldCost(); } break;
}
char tokenCost[250] = "\n";
if(sTransmogrification->GetRequireToken())
snprintf(tokenCost, 250, "\n\n%u x %s", sTransmogrification->GetTokenAmount(), GetItemName(sObjectMgr->GetItemTemplate(sTransmogrification->GetTokenEntry()), session).c_str());
for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++)
{
if (limit > 30)
break;
if (Item* newItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i))
{
uint32 display = newItem->GetTemplate()->DisplayInfoID;
if (player->SuitableForTransmogrification(oldItem, newItem) == ERR_FAKE_OK)
{
if (_items[lowGUID].find(display) == _items[lowGUID].end())
{
limit++;
_items[lowGUID][display] = newItem;
player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_INTERACT_1, GetItemName(newItem->GetTemplate(), session), uiAction, display, session->GetTrinityString(LANG_POPUP_TRANSMOGRIFY)+GetItemName(newItem->GetTemplate(), session)+tokenCost, price, false);
}
}
}
}
for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
{
if (Bag* bag = player->GetBagByPos(i))
{
for (uint32 j = 0; j < bag->GetBagSize(); j++)
{
if (limit > 30)
break;
if (Item* newItem = player->GetItemByPos(i, j))
{
uint32 display = newItem->GetTemplate()->DisplayInfoID;
if (player->SuitableForTransmogrification(oldItem, newItem) == ERR_FAKE_OK)
{
if (_items[lowGUID].find(display) == _items[lowGUID].end())
{
limit++;
_items[lowGUID][display] = newItem;
player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_INTERACT_1, GetItemName(newItem->GetTemplate(), session), uiAction, display, session->GetTrinityString(LANG_POPUP_TRANSMOGRIFY)+GetItemName(newItem->GetTemplate(), session)+tokenCost, price, false);
}
}
}
}
}
}
char removeOnePopup[250];
snprintf(removeOnePopup, 250, session->GetTrinityString(LANG_POPUP_REMOVE_ONE), GetSlotName(uiAction, session));
player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_INTERACT_1, session->GetTrinityString(LANG_OPTION_REMOVE_ONE), EQUIPMENT_SLOT_END+3, uiAction, removeOnePopup, 0, false);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, session->GetTrinityString(LANG_OPTION_BACK), EQUIPMENT_SLOT_END+1, 0);
player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
}
else
OnGossipHello(player, creature);
} break;
case EQUIPMENT_SLOT_END+1: // Back
{
OnGossipHello(player, creature);
} break;
case EQUIPMENT_SLOT_END+2: // Remove Transmogrifications
{
bool removed = false;
for (uint8 Slot = EQUIPMENT_SLOT_START; Slot < EQUIPMENT_SLOT_END; Slot++)
{
if (Item* newItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, Slot))
{
if (newItem->DeleteFakeEntry() && !removed)
removed = true;
}
}
if (removed)
{
session->SendAreaTriggerMessage(session->GetTrinityString(LANG_REM_TRANSMOGRIFICATIONS_ITEMS));
player->PlayDirectSound(3337);
}
else
session->SendNotification(session->GetTrinityString(LANG_ERR_NO_TRANSMOGRIFICATIONS));
OnGossipHello(player, creature);
} break;
//.........这里部分代码省略.........