本文整理汇总了C++中P_CHAR::IsOnline方法的典型用法代码示例。如果您正苦于以下问题:C++ P_CHAR::IsOnline方法的具体用法?C++ P_CHAR::IsOnline怎么用?C++ P_CHAR::IsOnline使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类P_CHAR
的用法示例。
在下文中一共展示了P_CHAR::IsOnline方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getNearbyChars
PCHAR_VECTOR* getNearbyChars( UI32 x, UI32 y, UI32 range, UI32 flags, P_CHAR pSelf )
{
PCHAR_VECTOR* pvCharsInRange = 0;
if( x > 0 && x < 6145 && y > 0 && y < 4097 )
{
pvCharsInRange = new PCHAR_VECTOR();
calculateBoundary( x, y, range );
PCHARLOCATIONMAPIT it( pCharLocationMap.lower_bound( locationToKey( upperLeft.x, upperLeft.y ) ) ),
end( pCharLocationMap.upper_bound( locationToKey( lowerRight.x, lowerRight.y) ) );
P_CHAR pc = 0;
for( ; it != end; ++it )
{
pc = it->second;
if( flags )
{
if( pSelf )
{
if( (flags & EXCLUDESELF) && pSelf->getSerial32() == pc->getSerial32() )
{
continue;
}
if ( (flags & COMBATTARGET) && pSelf->getSerial32() == pc->targserial )
{
pvCharsInRange->push_back( pc );
continue;
}
}
if ( pc->npc )
{
if ( (flags & NPC) )
{
pvCharsInRange->push_back( pc );
continue;
}
continue;
}
if ( (flags & ONLINE) && pc->IsOnline() )
{
pvCharsInRange->push_back( pc );
continue;
}
if ( (flags & OFFLINE) && !pc->IsOnline() )
{
pvCharsInRange->push_back( pc );
continue;
}
if ( (flags & DEAD) && pc->dead )
{
pvCharsInRange->push_back( pc );
continue;
}
}
else
{
pvCharsInRange->push_back( pc );
}
}
}
return pvCharsInRange;
}
示例2: ItemDroppedOnChar
//.........这里部分代码省略.........
return true;
}
else // The player is training from this NPC
{
ItemDroppedOnTrainer( ps, pp, pi);
}
}
if ( pTC->isHirable() )
{
// test if gold is enough
if ( pi->amount < pTC->getHireFee() )
{
pTC->talk(s, TRANSLATE("I need much more gold if i shall be working for you !"),0);
Sndbounce5(s);
if (ps->isDragging())
{
ps->resetDragging();
item_bounce5(s,pi);
}
return true;
}
else if ( pi->amount >= pTC->getHireFee() )
{
if ( pi->amount > pTC->getHireFee() )
{
pi->amount=(UI16)(pi->amount - pTC->getHireFee());
pTC->talk(s, TRANSLATE("Thank thee kindly, but this is more than i need for the day."),0);
Sndbounce5(s);
if (ps->isDragging())
{
ps->resetDragging();
item_bounce5(s,pi);
}
}
pTC->setOwner(pc_currchar);
tempfx::add(pTC,
pc_currchar,
tempfx::NPC_HIRECOST,
0,
0,
0,
0,
(UI16)(MY_CLOCKS_PER_SEC*secondsperuominute*60*24 )); // call callback every uo day
return true;
}
}
}//if human or not
}
else // dropped on another player
{
// By Polygon: Avoid starting the trade if GM drops item on logged on char (crash fix)
if ((pc_currchar->IsGM()) && !pTC->IsOnline())
{
// Drop the item in the players pack instead
// Get the pack
P_ITEM pack = pTC->getBackpack();
if (pack != NULL) // Valid pack?
{
pack->AddItem(pi); // Add it
weights::NewCalc(pTC);
}
else // No pack, give it back to the GM
{
pack = pc_currchar->getBackpack();
if (pack != NULL) // Valid pack?
{
pack->AddItem(pi); // Add it
weights::NewCalc(pc_currchar);
}
else // Even GM has no pack?
{
// Drop it to it's feet
pi->MoveTo( charpos );
pi->Refresh();
}
}
}
else
{
//<Luxor>: secure trade
P_ITEM tradeCont = tradestart(pc_currchar, pTC);
if (ISVALIDPI(tradeCont)) {
tradeCont->AddItem( pi, 30, 30 );
} else {
Sndbounce5(s);
if (ps->isDragging()) {
ps->resetDragging();
UpdateStatusWindow(s,pi);
}
}
//</Luxor>
}
}
}
else // dumping stuff to his own backpack !
{
ItemDroppedOnSelf( ps, pp, pi);
}
return true;
}