本文整理汇总了C++中P_CHAR::guildtitle方法的典型用法代码示例。如果您正苦于以下问题:C++ P_CHAR::guildtitle方法的具体用法?C++ P_CHAR::guildtitle怎么用?C++ P_CHAR::guildtitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类P_CHAR
的用法示例。
在下文中一共展示了P_CHAR::guildtitle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GuildTitle
// TESTED: OKAY (fine fine.. now proove that it really works.. )
// guildtitle(viewing character socket, clicked character) displays players title string, over the name
// of clicked character, name color gets calculated from the guild relationship of both players
// Called by: textflags()
void GuildTitle(int s, P_CHAR pc_player2)
{
char title[150];
char abbreviation[5];
char guildtype[10];
int tl;
if ( pc_player2 == NULL )
return;
if ( pc_player2->guildstone() != INVALID_SERIAL && pc_player2->guildtoggle() )
{
cGuildStone* pStone = dynamic_cast<cGuildStone*>(FindItemBySerial( pc_player2->guildstone() ));
strcpy(abbreviation, pStone->abbreviation.c_str());
if (!(strcmp(abbreviation,"")))
strcpy(abbreviation,"none");
switch (pStone->guildType)
{
case cGuildStone::order: strcpy(guildtype, "Order"); break;
case cGuildStone::chaos: strcpy(guildtype, "Chaos"); break;
default: break;
}
if (!pc_player2->guildtitle().isEmpty())
sprintf(title,"[%s, %s] [%s]",pc_player2->guildtitle().latin1(),abbreviation,guildtype);
else
sprintf(title,"[%s] [%s]",abbreviation, guildtype);
tl=44+strlen(title)+1;
talk[1]=tl>>8;
talk[2]=tl%256;
LongToCharPtr(pc_player2->serial, &talk[3]);
talk[7]=1;
talk[8]=1;
talk[9]=0;
ShortToCharPtr(pc_player2->emotecolor, &talk[10]);
talk[12]=0;
talk[13]=3;
Xsend(s, talk, 14);
Xsend(s, sysname, 30);
Xsend(s, title, strlen(title)+1);
}
示例2: Menu
// guildstonemenu() : Opens the guild menu for a player
// Recognizes Guildmaster with the owner fields of the stone.
// Ofcourse checks for membership before opening any gump ;)
void cGuildStone::Menu(UOXSOCKET s, int page)
{
//int total,i, counter,guild,recruit,war,member;
int counter = 1;
int lentext;
int gumpnum = 0;
char guildfealty[60],guildt[16],toggle[6];
static char mygump[MAXMEMRECWAR][257];
P_CHAR pc = currchar[s];
if (!isMember( pc ) && !pc->isGM())
{
sysmessage(s, "You are not a member of this guild. Ask an existing guildmember to invite you into this guild.");
return;
}
strcpy(guildfealty, "yourself");
if ((pc->guildfealty() != pc->serial)&&(pc->guildfealty() != INVALID_SERIAL))
{
vector<SERIAL>::iterator it = find(member.begin(), member.end(), pc->guildfealty());
if ( it != member.end())
{
strcpy(guildfealty, FindCharBySerial(*it)->name.c_str());
}
}
else
pc->setGuildfealty( pc->serial );
if (this->ownserial == INVALID_SERIAL)
CalcMaster();
P_CHAR guildmaster = FindCharBySerial(this->ownserial);
switch (this->guildType)
{
case standard: strcpy(guildt, " Standard"); break;
case order: strcpy(guildt, "n Order"); break;
case chaos: strcpy(guildt, " Chaos"); break;
}
if (pc->guildtoggle())
strcpy(toggle, "On");
else
strcpy(toggle, "Off");
// our prefix is 0xFE (darkstorm)
gmprefix[7] = 0xFE;
switch(page)
{
case 1:
gumpnum=9;
gmprefix[8] = 1;
if (guildmaster<0) return;
lentext = sprintf(mygump[0], "%s (%s %s)", this->guildName.c_str(), guildmaster->guildtitle().latin1(), guildmaster->name.c_str());
strcpy(mygump[1],"Recruit someone into the guild.");
strcpy(mygump[2],"View the current roster.");
strcpy(mygump[3],"View the guild's charter.");
sprintf(mygump[4],"Declare your fealty. You are currently loyal to %s.",guildfealty);
sprintf(mygump[5],"Toggle showing the guild's abbreviation in your name to unguilded people. Currently %s.",toggle);
strcpy(mygump[6],"Resign from the guild.");
strcpy(mygump[7],"View list of candidates who have been sponsored to the guild.");
if ((pc->serial == this->ownserial)|| (pc->isGM())) // Guildmaster Access?
{
gumpnum=10;
gmprefix[8] = 0;
sprintf(mygump[8],"Access %s functions.", guildmaster->guildtitle().latin1());
sprintf(mygump[9],"View list of guild that %s has declared war on.", this->guildName.c_str());
sprintf(mygump[10],"View list of guilds that have declared war on %s.",this->guildName.c_str());
} else { // Normal Members access!
sprintf(mygump[8],"View list of guilds that %s have declared war on.",this->guildName.c_str());
sprintf(mygump[9],"View list of guilds that have declared war on %s.",this->guildName.c_str());
}
break;
case 2: // guildmaster menu
gumpnum=14;
lentext = sprintf(mygump[0], "%s, %s functions", this->guildName.c_str(), guildmaster->guildtitle().latin1());
strcpy(mygump[1], "Set the guild name.");
strcpy(mygump[2], "Set the guild's abbreviation.");
sprintf(mygump[3], "Change the type of the guild. (Currently a%s guild.)",guildt);
strcpy(mygump[4], "Set the guild's charter.");
strcpy(mygump[5], "Dismiss a member.");
strcpy(mygump[6], "Declare war from menu.");
strcpy(mygump[7], "Declare war from targeting enemy.");
strcpy(mygump[8], "Declare peace.");
strcpy(mygump[9], "Accept a candidate seeking membership.");
strcpy(mygump[10],"Refuse a candidate seeking membership.");
strcpy(mygump[11],"Set the guildmaster's title.");
strcpy(mygump[12],"Grant a title to another member.");
strcpy(mygump[13],"Move this guildstone.");
strcpy(mygump[14],"Return to the main menu.");
gmprefix[8] = 2;
break;
case 3: // guild type
//.........这里部分代码省略.........