本文整理汇总了C++中NXWCLIENT::sysmsg方法的典型用法代码示例。如果您正苦于以下问题:C++ NXWCLIENT::sysmsg方法的具体用法?C++ NXWCLIENT::sysmsg怎么用?C++ NXWCLIENT::sysmsg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NXWCLIENT
的用法示例。
在下文中一共展示了NXWCLIENT::sysmsg方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ItemDroppedOnBeggar
static bool ItemDroppedOnBeggar(NXWCLIENT ps, PKGx08 *pp, P_ITEM pi)
{
if (ps == NULL)
return false;
VALIDATEPIR(pi, false);
char temp[TEMP_STR_SIZE]; //xan -> this overrides the global temp var
NXWSOCKET s=ps->toInt();
P_CHAR pc=ps->currChar();
VALIDATEPCR(pc,false);
P_CHAR pc_t=pointers::findCharBySerial(pp->Tserial); //beggar
VALIDATEPCR(pc_t,false);
if(pi->getId()!=ITEMID_GOLD)
{
sprintf(temp,TRANSLATE("Sorry %s i can only use gold"), pc->getCurrentNameC());
pc_t->talk( s,temp,0);
Sndbounce5(s);
if (ps->isDragging())
{
ps->resetDragging();
item_bounce5(s,pi);
return true;
}
}
else
{
sprintf(temp,TRANSLATE("Thank you %s for the %i gold!"), pc->getCurrentNameC(), pi->amount);
pc_t->talk( s,temp,0);
if(pi->amount<=100)
{
pc->IncreaseKarma(10);
ps->sysmsg(TRANSLATE("You have gain a little karma!"));
}
else if(pi->amount>100)
{
pc->IncreaseKarma(50);
ps->sysmsg(TRANSLATE("You have gain some karma!"));
}
pi->Delete();
return true;
}
return true;
}
示例2: ItemDroppedOnPet
static bool ItemDroppedOnPet(NXWCLIENT ps, PKGx08 *pp, P_ITEM pi)
{
if (ps == NULL) return false;
VALIDATEPIR(pi, false);
P_CHAR pet = pointers::findCharBySerial(pp->Tserial);
VALIDATEPCR(pet, false);
NXWSOCKET s = ps->toInt();
P_CHAR pc = ps->currChar();
VALIDATEPCR(pc, false);
if((pet->hunger<6) && (pi->type==ITYPE_FOOD))//AntiChrist new hunger code for npcs
{
pc->playSFX( (UI16)(0x3A+(rand()%3)) ); //0x3A - 0x3C three different sounds
if(pi->poisoned)
{
pet->applyPoison(PoisonType(pi->poisoned));
}
std::string itmname;
if( pi->getCurrentName() == "#" )
{
char temp2[TEMP_STR_SIZE]; //xan -> this overrides the global temp var
pi->getName(temp2);
itmname = temp2;
}
else itmname = pi->getCurrentName();
pet->emotecolor = 0x0026;
pet->emoteall(TRANSLATE("* You see %s eating %s *"), 1, pet->getCurrentNameC(), itmname.c_str() );
pet->hunger++;
} else
{
ps->sysmsg(TRANSLATE("It doesn't appear to want the item"));
Sndbounce5(s);
if (ps->isDragging())
{
ps->resetDragging();
item_bounce5(s,pi);
}
}
return true;
}
示例3: ItemDroppedOnSelf
static bool ItemDroppedOnSelf(NXWCLIENT ps, PKGx08 *pp, P_ITEM pi)
{
if (ps == NULL) return false;
VALIDATEPIR(pi, false);
// NXWSOCKET s=ps->toInt();
// CHARACTER cc=ps->currCharIdx();
P_CHAR pc = ps->currChar(); // MAKE_CHAR_REF(cc);
VALIDATEPCR(pc, false);
Location charpos = pc->getPosition();
if (pi->getId() >= 0x4000 ) // crashfix , prevents putting multi-objects ni your backback
{
ps->sysmsg(TRANSLATE("Hey, putting houses in your pack crashes your back and client !"));
pi->MoveTo( charpos );
pi->Refresh();//AntiChrist
return true;
}
// if (pi->glow>0) // glowing items
// {
// pc->addHalo(pi);
// pc->glowHalo(pi);
// }
P_ITEM pack = pc->getBackpack();
if (pack==NULL) // if player has no pack, put it at its feet
{
pi->MoveTo( charpos );
pi->Refresh();
}
else
{
pack->AddItem(pi); // player has a pack, put it in there
weights::NewCalc(pc);//AntiChrist bugfixes
statwindow(pc,pc);
pc->playSFX( itemsfx(pi->getId()) );
}
return true;
}
示例4: doubleclick
/*!
\brief Double click
\author Ripper, rewrite by Endymion
\param ps client of player dbclick
\note Completely redone by Morrolan 20-07-99
\warning I use a define CASE for make more readable the code, if you change name of P_ITEM pi chage also the macro
\todo los
*/
void doubleclick(NXWCLIENT ps)
{
if(ps==NULL) return;
P_CHAR pc = ps->currChar();
VALIDATEPC( pc );
NXWSOCKET s = ps->toInt();
// the 0x80 bit in the first byte is used later for "keyboard" and should be ignored
SERIAL serial = LongFromCharPtr(buffer[s] +1) & 0x7FFFFFFF;
if (isCharSerial(serial))
{
P_CHAR pd=pointers::findCharBySerial(serial);
if(ISVALIDPC(pd))
dbl_click_character(ps, pd);
return;
}
P_ITEM pi = pointers::findItemBySerial(serial);
VALIDATEPI(pi);
if (pi->amxevents[EVENT_IONDBLCLICK]!=NULL) {
g_bByPass = false;
pi->amxevents[EVENT_IONDBLCLICK]->Call( pi->getSerial32(), pc->getSerial32() );
if (g_bByPass==true)
return;
}
/*
g_bByPass = false;
pi->runAmxEvent( EVENT_IONDBLCLICK, pi->getSerial32(), s );
if (g_bByPass==true)
return;
*/
if (!checkItemUsability(pc , pi, ITEM_USE_DBLCLICK))
return;
Location charpos= pc->getPosition();
if (pc->IsHiddenBySpell()) return; //Luxor: cannot use items if under invisible spell
if ( !pc->IsGM() && pc->objectdelay >= uiCurrentTime )
{
pc->sysmsg(TRANSLATE("You must wait to perform another action."));
return;
}
else
pc->objectdelay = SrvParms->objectdelay * MY_CLOCKS_PER_SEC + uiCurrentTime;
///MODIFY, CANT CLICK ITEM AT DISTANCE >2//////////////
if ( (pc->distFrom(pi)>2) && !pc->IsGM() && !(pc->nxwflags[0] & cChar::flagSpellTelekinesys) ) //Luxor: let's check also for the telekinesys spell
{
pc->sysmsg( TRANSLATE("Must be closer to use this!"));
pc->objectdelay=0;
return;
}
//<Anthalir> VARIAIBLI
tile_st item;
P_ITEM pack= pc->getBackpack();
VALIDATEPI( pack );
data::seekTile( pi->getId(), item );
//////FINEVARIABILI
if ( ServerScp::g_nEquipOnDclick )
{
// equip the item only if it is in the backpack of the player
if ((pi->getContSerial() == pack->getSerial32()) && (item.quality != 0) && (item.quality != LAYER_BACKPACK) && (item.quality != LAYER_MOUNT))
{
int drop[2]= {-1, -1}; // list of items to drop, there no reason for it to be larger
int curindex= 0;
NxwItemWrapper wea;
wea.fillItemWeared( pc, true, true, true );
for( wea.rewind(); !wea.isEmpty(); wea++ )
{
P_ITEM pj=wea.getItem();
if(!ISVALIDPI(pj))
continue;
if ((item.quality == LAYER_1HANDWEAPON) || (item.quality == LAYER_2HANDWEAPON))// weapons
{
if (pi->itmhand == 2) // two handed weapons or shield
{
if (pj->itmhand == 2)
drop[curindex++]= DEREF_P_ITEM(pj);
if ( (pj->itmhand == 1) || (pj->itmhand == 3) )
//.........这里部分代码省略.........
示例5: loadFromScript
//.........这里部分代码省略.........
string2wstring( lha, oldmenu->title );
type = MAKE_NEED_INFO;
break;
case MAKE_NEED_INFO: { //1416 Armor
item++;
names.push_back( rha );
models.push_back( lha );
type = MAKE_NEED_RESOURCE;
break;
}
case MAKE_NEED_RESOURCE: //RESOURCE 10
if( lha!="RESOURCE" ) {
if ( item > INVALID ) //Luxor
LogWarning("create.xss, MAKEMENU %i: Expected 'RESOURCE <num>' after '%s'!", section, names[item].c_str() );
error=true;
}
else {
int needs = str2num(rha);
imk = new cMakeItem();
imk->skillToCheck=this->skill;
imk->reqitems[0].id=mat[0].id;
imk->reqitems[0].color=mat[0].color;
imk->reqitems[0].number=needs;
imk->reqitems[1].id=mat[1].id;
imk->reqitems[1].color=mat[1].color;
imk->reqitems[1].number=needs;
type=MAKE_NEED_SKILL;
}
break;
case MAKE_NEED_SKILL: //SKILL 500
if( lha!="SKILL" )
{
LogWarning("create.xss, MAKEMENU %i: Expected 'SKILL <num>' after RESOURCE !", section );
error=true;
}
else {
imk->minskill=str2num(rha);
imk->maxskill=imk->minskill*SrvParms->skilllevel; // by Magius(CHE)
if( imk->maxskill<200 )
imk->maxskill=200;
if( !imk->checkReq( pc, true, &this->mat[0] ) )
{
safedelete( imk );
item--;
names.pop_back();
models.pop_back();
canSee = false;
}
else {
makeItems.push_back( imk );
std::wstring w;
char b[TEMP_STR_SIZE];
if( mat[0].id!=0 ) {
sprintf( b, "%s %s - [%d/%d.%d]", models[item].c_str(), names[item].c_str(), imk->reqitems[0].number, imk->minskill/10, imk->minskill%10 );
}
else {
sprintf( b, "%s %s", models[item].c_str(), names[item].c_str() );
}
string2wstring( std::string( b ), w );
oldmenu->addMenuItem( 0, item, w );
type=MAKE_NEED_MENUORITEM;
canSee = true;
}
type=MAKE_NEED_MENUORITEM;
}
break;
case MAKE_NEED_MENUORITEM: //MAKEMENU 3 or ADDITEM $item_golden_ringmail_tunic
if( ( lha=="MAKEMENU" ) || ( lha=="ADDITEM" ) ) {
if( canSee )
imk->command = new cScriptCommand( lha, rha );
type = MAKE_NEED_INFO;
}
else {
LogWarning("create.xss, MAKEMENU %i: Expected'MAKEMENU or ADDITEM after 'SKILL %i'!", section, imk->minskill );
error=true;
}
break;
}
}
while( !error && (++loopexit < MAXLOOPS) );
if( item<=0 ) {
ps->sysmsg( TRANSLATE("You aren't skilled enough to make anything with what you have.") );
}
safedelete(iter);
if( error ) {
ConOut( "[ERROR] on cration of makemenu %d\n", section );
return;
}
}
示例6: execMake
/*!
\brief executes a "MAKE" command
\author Xanathar
\param pc player who do make
\param n item number
*/
void cMakeMenu::execMake( NXWCLIENT ps, UI32 item )
{
P_CHAR pc = ps->currChar();
if( pc->dead ) {
pc->sysmsg(TRANSLATE("Ever thought an ethereal soul can't really do some actions ?"));
return;
}
cMakeItem* mi = makeItems[item];
if( ( mi==NULL ) || ( mi->command==NULL ) )
return;
if( mi->command->command=="MAKEMENU" ) {
Skills::MakeMenu( pc, str2num( mi->command->param ), skill, mat[0].id, mat[0].color, mat[1].id, mat[1].color );
return;
}
if( pc->IsGM() ) {
mi->command->execute( ps->toInt() );
return;
}
if( !mi->checkReq( pc ) )
return;
bool failed = false;
if( !pc->checkSkill((Skill)mi->skillToCheck, mi->minskill, mi->maxskill) ) {
failed = true;
}
for( int j=0; j<2; ++j ) {
cRawItem& raw = mi->reqitems[j];
if( raw.id!=0 ) {
UI16 matToDel = raw.number;
if( failed )
matToDel = ( matToDel/2>0 )? matToDel/2 : 1;
pc->delItems( raw.id, matToDel, raw.color );
}
}
switch( skill )
{
case MINING :
pc->playSFX(0x0054);
break;
case BLACKSMITHING :
pc->playSFX(0x002A);
break;
case CARPENTRY :
pc->playSFX(0x023D);
break;
case INSCRIPTION :
pc->playSFX(0x0249);
break;
case TAILORING :
pc->playSFX(0x0248);
break;
case TINKERING :
pc->playSFX(0x002A);
break;
case CARTOGRAPHY :
pc->playSFX(0x0249);
break;
}
pc->setObjectDelay();
std::string script;
std::string amount;
splitLine( mi->command->param, script, amount );
if( !failed ) {
P_ITEM pi = item::CreateFromScript( str2num( script ), pc->getBackpack(), (amount!="")? str2num( amount ) : INVALID );
VALIDATEPI(pi);
ps->sysmsg(TRANSLATE("You create the item and place it in your backpack."));
pi->magic = 1;
pi->creator = pc->getCurrentName(); // Memorize Name of the creator
if (pc->skill[skill]>950)
pi->madewith=skill+1; // Memorize Skill used
else
pi->madewith=0-skill-1; // Memorize Skill used ( negative not shown )
}
else {
//.........这里部分代码省略.........
示例7: wear_item
void wear_item(NXWCLIENT ps) // Item is dropped on paperdoll
{
if ( ps == NULL )
return;
NXWSOCKET s = ps->toInt();
if (s < 0)
return;
P_CHAR pc=ps->currChar();
VALIDATEPC( pc );
P_CHAR pck = pointers::findCharBySerPtr(buffer[s]+6);
VALIDATEPC( pck );
if( pck->dead ) //Exploit fix: Dead ppl can't equip anything.
return;
P_ITEM pi=pointers::findItemBySerPtr(buffer[s]+1);
VALIDATEPI(pi);
bool resetDragging = false;
if( (pi->getId()>>8) >= 0x40) // LB, client crashfix if multi-objects are moved to PD
resetDragging = true;
tile_st tile;
int serial/*, letsbounce=0*/; // AntiChrist (5) - new ITEMHAND system
data::seekTile(pi->getId(), tile);
if( ( clientDimension[s]==3 ) && (tile.quality==0) )
{
ps->sysmsg(TRANSLATE("You can't wear that"));
resetDragging = true;
}
else {
P_ITEM outmost = pi->getOutMostCont();
P_CHAR vendor = pointers::findCharBySerial( outmost->getContSerial() );
if( ISVALIDPC( vendor ) && ( vendor->getOwnerSerial32() != pc->getSerial32() ) )
{
resetDragging = true;
}
}
if( resetDragging ) {
Sndbounce5(s);
if (ps->isDragging())
{
ps->resetDragging();
item_bounce4(s,pi);
UpdateStatusWindow(s,pi);
}
return;
}
if ( pck->getSerial32() == pc->getSerial32() || pc->IsGM() )
{
if ( !pc->IsGM() && pi->st > pck->getStrength() && !pi->isNewbie() ) // now you can equip anything if it's newbie
{
ps->sysmsg(TRANSLATE("You are not strong enough to use that."));
resetDragging = true;
}
else if ( !pc->IsGM() && !checkItemUsability(pc, pi, ITEM_USE_WEAR) )
{
resetDragging = true;
}
else if ( (pc->getId() == BODY_MALE) && ( pi->getId()==0x1c00 || pi->getId()==0x1c02 || pi->getId()==0x1c04 || pi->getId()==0x1c06 || pi->getId()==0x1c08 || pi->getId()==0x1c0a || pi->getId()==0x1c0c ) ) // Ripper...so males cant wear female armor
{
ps->sysmsg(TRANSLATE("You cant wear female armor!"));
resetDragging = true;
}
else if ((((pi->magic==2)||((tile.weight==255)&&(pi->magic!=1))) && !pc->canAllMove()) ||
( (pi->magic==3|| pi->magic==4) && !(pi->getOwnerSerial32()==pc->getSerial32())))
{
resetDragging = true;
}
if( resetDragging ) {
Sndbounce5(s);
if (ps->isDragging())
{
ps->resetDragging();
item_bounce4(s,pi);
UpdateStatusWindow(s,pi);
}
return;
}
// - AntiChrist (4) - checks for new ITEMHAND system
// - now you can't equip 2 hnd weapons with 1hnd weapons nor shields!!
serial= pck->getSerial32(); //xan -> k not cc :)
P_ITEM pj = NULL;
P_CHAR pc_currchar= pck;
// P_ITEM pack= pc_currchar->getBackpack();
//<Luxor>
P_ITEM pW = pc_currchar->getWeapon();
if (tile.quality == 1 || tile.quality == 2)
{ //weapons layers
//.........这里部分代码省略.........
示例8: pack_item
void pack_item(NXWCLIENT ps, PKGx08 *pp) // Item is put into container
{
if (ps == NULL) return;
char temp[TEMP_STR_SIZE]; //xan -> this overrides the global temp var
char temp2[TEMP_STR_SIZE]; //xan -> this overrides the global temp var
int serial/*, serhash*/;
tile_st tile;
// bool abort=false;
NXWSOCKET s=ps->toInt();
P_CHAR pc=ps->currChar();
VALIDATEPC(pc);
Location charpos= pc->getPosition();
P_ITEM pack;
P_ITEM pCont = pointers::findItemBySerial(pp->Tserial);
VALIDATEPI(pCont);
P_ITEM pItem = pointers::findItemBySerial(pp->Iserial);
VALIDATEPI(pItem);
if (pItem->getId() >= 0x4000)
{
// abort=true; // LB crashfix that prevents moving multi objcts in BP's
ps->sysmsg(TRANSLATE("Hey, putting houses in your pack crashes your back and client!"));
}
//ndEndy recurse only a time
P_ITEM contOutMost = pCont->getOutMostCont();
P_CHAR contOwner = ( !contOutMost->isInWorld() )? pointers::findCharBySerial( contOutMost->getContSerial() ) : NULL;
if( ISVALIDPC(contOwner) ) {
//if ((contOwner->npcaitype==NPCAI_PLAYERVENDOR) && (contOwner->npc) && (contOwner->getOwnerSerial32()!=pc->getSerial32()) )
if ( contOwner->getSerial32() != pc->getSerial32() && contOwner->getOwnerSerial32() != pc->getSerial32() && !pc->IsGM() ) { // Luxor
ps->sysmsg(TRANSLATE("This aint your backpack!"));
Sndbounce5(s);
if (ps->isDragging()) {
ps->resetDragging();
item_bounce3(pItem);
if (pCont->getId() >= 0x4000)
senditem(s, pCont);
}
return;
}
}
if (pCont->amxevents[EVENT_IONPUTITEM]!=NULL) {
g_bByPass = false;
pCont->amxevents[EVENT_IONPUTITEM]->Call( pCont->getSerial32(), pItem->getSerial32(), pc->getSerial32() );
if (g_bByPass)
{
item_bounce6(ps,pItem);
return;
}
}
/*
g_bByPass = false;
pCont->runAmxEvent( EVENT_IONPUTITEM, pCont->getSerial32(), pItem->getSerial32(), pc->getSerial32() );
if (g_bByPass)
{ //AntiChrist to preview item disappearing
item_bounce6(ps,pItem);
return;
}
*/
if (pCont->layer==0 && pCont->getId() == 0x1E5E &&
pCont->getContSerial()==pc->getSerial32())
{
// Trade window???
serial=calcserial(pCont->moreb1, pCont->moreb2, pCont->moreb3, pCont->moreb4);
if(serial==-1) return;
P_ITEM pi_z = pointers::findItemBySerial(serial);
if (ISVALIDPI(pi_z))
if ((pi_z->morez || pCont->morez))
{
pi_z->morez=0;
pCont->morez=0;
sendtradestatus( pi_z, pCont );
}
}
if(SrvParms->usespecialbank)//only if special bank is activated
{
if(pCont->morey==MOREY_GOLDONLYBANK && pCont->morex==MOREX_BANK && pCont->type==ITYPE_CONTAINER)
{
if ( pItem->getId() == ITEMID_GOLD )
{//if they're gold ok
pc->playSFX( goldsfx(2) );
} else
{//if they're not gold..bounce on ground
ps->sysmsg(TRANSLATE("You can only put golds in this bank box!"));
pItem->setContSerial(-1);
pItem->MoveTo( charpos );
pItem->Refresh();
//.........这里部分代码省略.........
示例9: dump_item
void dump_item(NXWCLIENT ps, PKGx08 *pp) // Item is dropped on ground or a character
{
if (ps == NULL) return;
tile_st tile;
NXWSOCKET s=ps->toInt();
P_CHAR pc=ps->currChar();
VALIDATEPC(pc);
P_ITEM pi=pointers::findItemBySerial(pp->Iserial);
if (!ISVALIDPI(pi))
{
LogError("client sent bad itemserial %d",pp->Iserial);
return;
}
if ( isCharSerial(pi->getContSerial()) && pi->getContSerial() != pc->getSerial32() ) {
P_CHAR pc_i = pointers::findCharBySerial(pi->getContSerial());
if (ISVALIDPC(pc_i))
pc_i->sysmsg("Warning, backpack disappearing bug located!");
if (ps->isDragging()) {
ps->resetDragging();
UpdateStatusWindow(s,pi);
}
pi->setContSerial( pi->getContSerial(true) );
pi->setPosition( pi->getOldPosition() );
pi->layer = pi->oldlayer;
pi->Refresh();
}
if (pi->magic == 2) { //Luxor -- not movable objects
if (ps->isDragging()) {
ps->resetDragging();
UpdateStatusWindow(s,pi);
}
pi->setContSerial( pi->getContSerial(true) );
pi->MoveTo( pi->getOldPosition() );
pi->layer = pi->oldlayer;
pi->Refresh();
return;
}
if(pi!=NULL)
{
weights::NewCalc(pc);
statwindow(pc,pc);
}
//Ripper...so order/chaos shields disappear when on ground.
if( pi->getId()==0x1BC3 || pi->getId()==0x1BC4 )
{
pc->playSFX( 0x01FE);
staticeffect(DEREF_P_CHAR(pc), 0x37, 0x2A, 0x09, 0x06);
pi->Delete();
return;
}
//test UOP blocking Tauriel 1-12-99
if (!pi->isInWorld())
{
item_bounce6(ps,pi);
return;
}
data::seekTile(pi->getId(), tile);
if (!pc->IsGM() && ((pi->magic==2 || (tile.weight==255 && pi->magic!=1))&&!pc->canAllMove()) ||
( (pi->magic==3 || pi->magic==4) && !(pi->getOwnerSerial32()==pc->getSerial32())))
{
item_bounce6(ps,pi);
return;
}
if (buffer[s][5]!=(unsigned char)'\xFF')
{
if (pi->amxevents[EVENT_IDROPINLAND]!=NULL)
{
g_bByPass = false;
pi->MoveTo(pp->TxLoc,pp->TyLoc,pp->TzLoc);
pi->amxevents[EVENT_IDROPINLAND]->Call( pi->getSerial32(), pc->getSerial32() );
if (g_bByPass) {
pi->Refresh();
return;
}
}
/*
//.........这里部分代码省略.........