本文整理汇总了C++中CGrayUID类的典型用法代码示例。如果您正苦于以下问题:C++ CGrayUID类的具体用法?C++ CGrayUID怎么用?C++ CGrayUID使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CGrayUID类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DelObj
void CItemSpawn::DelObj(CGrayUID uid)
{
ADDTOCALLSTACK("CitemSpawn:DelObj");
if ( !uid.IsValidUID() )
return;
BYTE iMax = GetCount();
for ( BYTE i = 0; i < iMax; i++ )
{
if ( m_obj[i] != uid )
continue;
CObjBase *pObj = uid.ObjFind();
pObj->m_uidSpawnItem.InitUID();
m_currentSpawned--;
if ( GetType() == IT_SPAWN_CHAR )
uid.CharFind()->StatFlag_Clear(STATF_Spawned);
while ( m_obj[i + 1].IsValidUID() ) // searching for any entry higher than this one...
{
m_obj[i] = m_obj[i + 1]; // and moving it 1 position to keep values 'together'.
i++;
}
m_obj[i].InitUID(); // Finished moving higher entries (if any) so we free the last entry.
break;
}
ResendTooltip();
}
示例2: AddObj
// Storing one UID in Spawn's m_obj[]
void CItemSpawn::AddObj( CGrayUID uid )
{
ADDTOCALLSTACK("CitemSpawn:AddObj");
unsigned char iMax = GetAmount() > 0 ? static_cast<unsigned char>(GetAmount()) : 1;
iMax += 1; // We must give a +1 to create a 'free slot'
bool bIsSpawnChar = GetType() == IT_SPAWN_CHAR;
if (bIsSpawnChar )
{
if (!uid || !uid.CharFind()->m_pNPC) // Only adding UIDs...
return;
}
if ( uid.ObjFind()->m_uidSpawnItem.ItemFind() ) //... which doesn't have a SpawnItem already
return;
for ( unsigned char i = 0; i < iMax; i++ )
{
if ( m_obj[i] == uid ) // Not adding me again
return;
if ( !m_obj[i].ObjFind() )
{
m_obj[i] = uid;
if (bIsSpawnChar)
{
m_itSpawnChar.m_current++;
uid.CharFind()->StatFlag_Set(STATF_Spawned);
}
uid.ObjFind()->m_uidSpawnItem = GetUID();
break;
}
}
}
示例3: AddObj
void CItemSpawn::AddObj( CGrayUID uid )
{
ADDTOCALLSTACK("CitemSpawn:AddObj");
unsigned char iMax = GetAmount() > 0 ? static_cast<unsigned char>(GetAmount()) : 1;
bool bIsSpawnChar = GetType() == IT_SPAWN_CHAR;
if (!uid)
return;
if ( bIsSpawnChar )
{
if ( !uid.CharFind()->m_pNPC) // Only adding NPCs to IT_SPAWN_CHAR..
return;
if ( uid.CharFind()->m_uidSpawnItem.ItemFind() ) //... if they doesn't have a SpawnItem already.
return;
} else if( !uid.ItemFind() ) // Only adding Items to IT_SPAWN_ITEM
return;
for ( unsigned char i = 0; i < iMax; i++ )
{
if ( m_obj[i] == uid ) // Not adding me again
return;
if ( !m_obj[i].ObjFind() )
{
m_obj[i] = uid;
if (bIsSpawnChar)
{
m_itSpawnChar.m_current++;
uid.CharFind()->StatFlag_Set(STATF_Spawned);
}
uid.ObjFind()->m_uidSpawnItem = GetUID();
break;
}
}
}
示例4: addGumpDialogProps
bool CClient::addGumpDialogProps( CGrayUID uid )
{
ADDTOCALLSTACK("CClient::addGumpDialogProps");
// put up a prop dialog for the object.
CObjBase * pObj = uid.ObjFind();
if ( pObj == NULL )
return false;
if ( m_pChar == NULL )
return( false );
if ( ! m_pChar->CanTouch( pObj )) // probably a security issue.
return( false );
m_Prop_UID = m_Targ_UID = uid;
if ( uid.IsChar() )
addSkillWindow(static_cast<SKILL_TYPE>(g_Cfg.m_iMaxSkill), true);
TCHAR *pszMsg = Str_GetTemp();
strcpy(pszMsg, pObj->IsItem() ? "d_ITEMPROP1" : "d_CHARPROP1" );
RESOURCE_ID rid = g_Cfg.ResourceGetIDType(RES_DIALOG, pszMsg);
if ( ! rid.IsValidUID())
return false;
Dialog_Setup( CLIMODE_DIALOG, rid, 0, pObj );
return( true );
}
示例5: ADDTOCALLSTACK
bool CPartyDef::RemoveMember( CGrayUID uidRemove, CGrayUID uidCommand )
{
ADDTOCALLSTACK("CPartyDef::RemoveMember");
// ARGS:
// uidRemove = Who is being removed.
// uidCommand = who removed this person (only the master or self can remove)
//
// NOTE: remove of the master will cause the party to disband.
if ( m_Chars.GetCharCount() <= 0 )
return false;
CGrayUID uidMaster = GetMaster();
if ( (uidRemove != uidCommand) && (uidCommand != uidMaster) )
return false;
CChar *pCharRemove = uidRemove.CharFind();
if ( !pCharRemove )
return false;
if ( !IsInParty(pCharRemove) )
return false;
if ( uidRemove == uidMaster )
return Disband(uidMaster);
CChar *pSrc = uidCommand.CharFind();
if ( pSrc && IsTrigUsed(TRIGGER_PARTYREMOVE) )
{
CScriptTriggerArgs args;
if ( pCharRemove->OnTrigger(CTRIG_PartyRemove, pSrc, &args) == TRIGRET_RET_TRUE )
return false;
}
if ( IsTrigUsed(TRIGGER_PARTYLEAVE) )
{
if ( pCharRemove->OnTrigger(CTRIG_PartyLeave, pCharRemove, 0) == TRIGRET_RET_TRUE )
return false;
}
// Remove it from the party
SendRemoveList(pCharRemove, true);
DetachChar(pCharRemove);
pCharRemove->SysMessageDefault(DEFMSG_PARTY_LEAVE_2);
TCHAR *pszMsg = Str_GetTemp();
sprintf(pszMsg, g_Cfg.GetDefaultMsg(DEFMSG_PARTY_LEAVE_1), pCharRemove->GetName());
SysMessageAll(pszMsg);
if ( m_Chars.GetCharCount() <= 1 )
{
// Disband the party
SysMessageAll(g_Cfg.GetDefaultMsg(DEFMSG_PARTY_LEAVE_LAST_PERSON));
return Disband(uidMaster);
}
return true;
}
示例6: DeclineEvent
// ---------------------------------------------------------
bool CPartyDef::DeclineEvent( CChar * pCharDecline, CGrayUID uidInviter ) // static
{
ADDTOCALLSTACK("CPartyDef::DeclineEvent");
// This should happen after a timeout as well.
// " You notify %s that you do not wish to join the party"
CChar * pCharInviter = uidInviter.CharFind();
if ( !pCharInviter || !pCharDecline )
return( false );
if ( uidInviter == pCharDecline->GetUID() )
return( false );
CVarDefCont * sTempVal = pCharInviter->GetTagDefs()->GetKey("PARTY_LASTINVITE");
if ( !sTempVal )
return( false );
if ((DWORD)sTempVal->GetValNum() != (DWORD)pCharDecline->GetUID())
return( false );
// Remove the key
pCharInviter->DeleteKey("PARTY_LASTINVITE");
TCHAR * sTemp = Str_GetTemp();
sprintf(sTemp, g_Cfg.GetDefaultMsg(DEFMSG_PARTY_DECLINE_2), static_cast<LPCTSTR>(pCharInviter->GetName()));
pCharDecline->SysMessage( sTemp );
sTemp = Str_GetTemp();
sprintf(sTemp, g_Cfg.GetDefaultMsg(DEFMSG_PARTY_DECLINE_1), static_cast<LPCTSTR>(pCharDecline->GetName()));
pCharInviter->SysMessage( sTemp );
return( true );
}
示例7: MessageEvent
// ---------------------------------------------------------
bool CPartyDef::MessageEvent( CGrayUID uidDst, CGrayUID uidSrc, const NCHAR * pText, int ilenmsg )
{
ADDTOCALLSTACK("CPartyDef::MessageEvent");
UNREFERENCED_PARAMETER(ilenmsg);
if ( pText == NULL )
return( false );
if ( uidDst && !IsInParty( uidDst.CharFind() ) )
return( false );
CChar * pFrom = uidSrc.CharFind();
CChar * pTo = NULL;
if ( uidDst != (DWORD) 0 )
pTo = uidDst.CharFind();
TCHAR * szText = Str_GetTemp();
CvtNUNICODEToSystem( szText, MAX_TALK_BUFFER, pText, MAX_TALK_BUFFER );
if ( ! m_pSpeechFunction.IsEmpty() )
{
TRIGRET_TYPE tr = TRIGRET_RET_FALSE;
CScriptTriggerArgs Args;
Args.m_iN1 = uidSrc;
Args.m_iN2 = uidDst;
Args.m_s1 = szText;
Args.m_s1_raw = szText;
if ( r_Call(m_pSpeechFunction, &g_Serv, &Args, NULL, &tr) )
{
if ( tr == TRIGRET_RET_TRUE )
return( false );
}
}
if ( g_Log.IsLoggedMask( LOGM_PLAYER_SPEAK ))
g_Log.Event( LOGM_PLAYER_SPEAK, "%lx:'%s' Says '%s' in party to '%s'\n", pFrom->GetClient()->GetSocketID(), pFrom->GetName(), szText, pTo ? pTo->GetName() : "all" );
sprintf(szText, g_Cfg.GetDefaultMsg( DEFMSG_PARTY_MSG ), pText);
PacketPartyChat cmd(pFrom, pText);
if ( pTo != NULL )
SendMemberMsg(pTo, &cmd);
else
SendAll(&cmd);
return( true );
}
示例8: ADDTOCALLSTACK
bool CItemSpawn::r_LoadVal(CScript & s)
{
ADDTOCALLSTACK("CitemSpawn:r_LoadVal");
EXC_TRY("LoadVal");
if (g_Serv.IsLoading())
{
if (!strnicmp(s.GetKey(), "more2", 5)) //More2 shouldn't be loaded as it's being set with ADDOBJ
return true;
}
int iCmd = FindTableSorted(s.GetKey(), sm_szLoadKeys, COUNTOF(sm_szLoadKeys) - 1);
if (iCmd < 0)
return CItem::r_LoadVal(s);
switch (iCmd)
{
case ISPW_ADDOBJ:
{
CGrayUID uid = static_cast<CGrayUID>(s.GetArgVal());
if ( uid.ObjFind() )
AddObj(uid);
return true;
}
case ISPW_DELOBJ:
{
CGrayUID uid = static_cast<CGrayUID>(s.GetArgVal());
if (uid.ObjFind())
DelObj(uid);
return true;
}
case ISPW_RESET:
KillChildren();
return true;
case ISPW_START:
SetTimeout(0);
return true;
case ISPW_STOP:
KillChildren();
SetTimeout(-1);
return true;
default:
break;
}
EXC_CATCH;
return false;
}
示例9: DelObj
void CItemSpawn::DelObj( CGrayUID uid )
{
ADDTOCALLSTACK("CitemSpawn:DelObj");
if ( !uid.IsValidUID() )
return;
for ( unsigned char i = 0; i < GetCount(); i++ )
{
if ( m_obj[i].IsValidUID() && m_obj[i] == uid ) // found this uid, proceeding to clear it
{
if (GetType() == IT_SPAWN_CHAR) // IT_SPAWN_ITEM uses 'more2' to store how much items to spawn at once, so we must not touch it.
m_itSpawnChar.m_current--; // found this UID in the spawn's list, decreasing CChar's count only in this case
while ( m_obj[i + 1].IsValidUID() ) // searching for any entry higher than this one...
{
m_obj[i] = m_obj[i + 1]; // and moving it 1 position to keep values 'together'.
i++;
}
m_obj[i].InitUID(); // Finished moving higher entries (if any) so we free the last entry.
break;
}
}
if (uid.ItemFind())
uid.ItemFind()->m_uidSpawnItem.InitUID();
else if (uid.CharFind())
{
uid.CharFind()->m_uidSpawnItem.InitUID();
uid.CharFind()->StatFlag_Clear(STATF_Spawned);
}
}
示例10: AddObj
void CItemSpawn::AddObj(CGrayUID uid)
{
ADDTOCALLSTACK("CitemSpawn:AddObj");
// NOTE: This function is also called when loading spawn items
// on server startup. In this case, some objs UID still invalid
// (not loaded yet) so just proceed without any checks.
bool bIsSpawnChar = IsType(IT_SPAWN_CHAR);
if ( !g_Serv.IsLoading() )
{
if ( !uid.IsValidUID() )
return;
if ( bIsSpawnChar ) // IT_SPAWN_CHAR can only spawn NPCs
{
CChar *pChar = uid.CharFind();
if ( !pChar || !pChar->m_pNPC )
return;
}
else if ( !uid.ItemFind() ) // IT_SPAWN_ITEM can only spawn items
return;
CItemSpawn *pPrevSpawn = static_cast<CItemSpawn*>(uid.ObjFind()->m_uidSpawnItem.ItemFind());
if ( pPrevSpawn )
{
if ( pPrevSpawn == this ) // obj already linked to this spawn
return;
pPrevSpawn->DelObj(uid); // obj linked to other spawn, remove the link before proceed
}
}
BYTE iMax = maximum(GetAmount(), 1);
for (BYTE i = 0; i < iMax; i++ )
{
if ( !m_obj[i].IsValidUID() )
{
m_obj[i] = uid;
m_currentSpawned++;
// objects are linked to the spawn at each server start
if ( !g_Serv.IsLoading() )
{
uid.ObjFind()->m_uidSpawnItem = GetUID();
if ( bIsSpawnChar )
{
CChar *pChar = uid.CharFind();
ASSERT(pChar->m_pNPC);
pChar->StatFlag_Set(STATF_Spawned);
pChar->m_ptHome = GetTopPoint();
pChar->m_pNPC->m_Home_Dist_Wander = static_cast<WORD>(m_itSpawnChar.m_DistMax);
}
}
break;
}
}
if ( !g_Serv.IsLoading() )
ResendTooltip();
}
示例11: if
bool CScriptObj::r_GetRef( LPCTSTR & pszKey, CScriptObj * & pRef )
{
// A key name that just links to another object.
if ( !strnicmp(pszKey, "SERV.", 5) && strnicmp(pszKey, "SERV.NEW", 8) )
{
pszKey += 5;
pRef = &g_Serv;
return true;
}
else if ( !strnicmp(pszKey, "UID.", 4) )
{
pszKey += 4;
CGrayUID uid = (DWORD)Exp_GetVal(pszKey);
SKIP_SEPERATORS(pszKey);
pRef = uid.ObjFind();
return true;
}
else if ( ! strnicmp( pszKey, "OBJ.", 4 ))
{
pszKey += 4;
pRef = ( (DWORD)g_World.m_uidObj ) ? g_World.m_uidObj.ObjFind() : NULL;
return true;
}
else if ( !strnicmp(pszKey, "NEW.", 4) )
{
pszKey += 4;
pRef = ( (DWORD)g_World.m_uidNew ) ? g_World.m_uidNew.ObjFind() : NULL;
return true;
}
else if ( !strnicmp(pszKey, "I.", 2) )
{
pszKey += 2;
pRef = this;
return true;
}
return false;
}
示例12: WeDeclarePeace
void CItemStone::WeDeclarePeace(CGrayUID uid, bool fForcePeace)
{
ADDTOCALLSTACK("CItemStone::WeDeclarePeace");
CItemStone * pEnemyStone = dynamic_cast <CItemStone*>( uid.ItemFind());
if (!pEnemyStone)
return;
CStoneMember * pMember = GetMember(pEnemyStone);
if ( ! pMember ) // No such member
return;
// Set my flags on the subject.
if (!pMember->GetTheyDeclared() || fForcePeace) // If they're not at war with us, delete this record
delete pMember;
else
pMember->SetWeDeclared(false);
pEnemyStone->TheyDeclarePeace( this, fForcePeace );
}
示例13: Disband
bool CPartyDef::Disband( CGrayUID uidMaster )
{
ADDTOCALLSTACK("CPartyDef::Disband");
// Make sure i am the master.
if ( m_Chars.GetCharCount() <= 0 )
return false;
if ( GetMaster() != uidMaster )
return false;
CChar *pMaster = GetMaster().CharFind();
if ( pMaster && IsTrigUsed(TRIGGER_PARTYDISBAND) )
{
CScriptTriggerArgs args;
if ( pMaster->OnTrigger(CTRIG_PartyDisband, pMaster, &args) == TRIGRET_RET_TRUE )
return false;
}
SysMessageAll(g_Cfg.GetDefaultMsg(DEFMSG_PARTY_DISBANDED));
CChar *pSrc = uidMaster.CharFind();
size_t iQty = m_Chars.GetCharCount();
ASSERT(iQty > 0);
CChar *pChar = NULL;
for ( size_t i = 0; i < iQty; i++ )
{
pChar = m_Chars.GetChar(i).CharFind();
if ( !pChar )
continue;
if ( IsTrigUsed(TRIGGER_PARTYREMOVE) )
{
CScriptTriggerArgs args;
args.m_iN1 = 1;
pChar->OnTrigger(CTRIG_PartyRemove, pSrc, &args);
}
SendRemoveList(pChar, true);
DetachChar(pChar);
}
delete this; // should remove itself from the world list.
return true;
}
示例14:
CStoneMember::CStoneMember( CItemStone * pStone, CGrayUID uid, STONEPRIV_TYPE iType, LPCTSTR pTitle, CGrayUID loyaluid, bool fVal1, bool fVal2, int nAccountGold)
{
m_uidLinkTo = uid;
m_sTitle = pTitle;
m_iPriv = iType;
m_uidLoyalTo = loyaluid;
// union.
if ( iType == STONEPRIV_ENEMY )
{
m_Enemy.m_fTheyDeclared = fVal1;
m_Enemy.m_fWeDeclared = fVal2;
}
else
{
m_Member.m_fAbbrev = fVal1;
m_Member.m_iVoteTally = fVal2; // Temporary space to calculate votes.
}
m_Member.m_iAccountGold = nAccountGold;
if ( ! g_Serv.IsLoading() && pStone->GetMemoryType())
{
CChar * pChar = uid.CharFind();
if ( pChar != NULL )
{
pChar->Memory_AddObjTypes(pStone, static_cast<WORD>(pStone->GetMemoryType()));
if ( pStone->IsTopLevel())
{
pChar->m_ptHome = pStone->GetTopPoint(); // Our new home.
}
}
}
pStone->InsertTail( this );
}
示例15: ADDTOCALLSTACK
//.........这里部分代码省略.........
{
if ( pszArgs[0] != '\0' )
{
pMember = STATIC_CAST <CStoneMember *>(GetHead());
CScript scriptVerb( pszArgs );
for (; pMember != NULL; pMember = pMember->GetNext())
{
if ( !pMember->GetLinkUID().IsChar() )
continue;
if ( iFlags == -1 )
{
pMember->r_Verb(scriptVerb, pSrc);
}
else if ( pMember->GetPriv() == static_cast<STONEPRIV_TYPE>(iFlags) )
{
pMember->r_Verb(scriptVerb, pSrc);
}
}
}
else
{
g_Log.EventError("ItemStone::AllMembers empty args.\n");
return false;
}
}
}
}
break;
case ISV_APPLYTOJOIN:
if ( s.HasArgs())
{
CGrayUID pMemberUid = s.GetArgVal();
CChar * pMemberChar = pMemberUid.CharFind();
if ( pMemberChar )
{
AddRecruit( pMemberChar, STONEPRIV_CANDIDATE );
}
}
break;
case ISV_CHANGEALIGN:
if ( s.HasArgs())
{
SetAlignType(static_cast<STONEALIGN_TYPE>(s.GetArgVal()));
TCHAR *pszMsg = Str_GetTemp();
sprintf(pszMsg, "%s is now a %s %s\n", static_cast<LPCTSTR>(GetName()), static_cast<LPCTSTR>(GetAlignName()), static_cast<LPCTSTR>(GetTypeName()));
Speak(pszMsg);
}
break;
case ISV_DECLAREPEACE:
if ( s.HasArgs())
{
CGrayUID pMemberUid = s.GetArgVal();
WeDeclarePeace(pMemberUid);
}
break;
case ISV_DECLAREWAR:
if ( s.HasArgs())
{
CGrayUID pMemberUid = s.GetArgVal();
CItem * pEnemyItem = pMemberUid.ItemFind();
if ( pEnemyItem )
{
CItemStone * pNewEnemy = dynamic_cast<CItemStone*>(pEnemyItem);
if ( pNewEnemy )