本文整理汇总了C++中ADDWORD函数的典型用法代码示例。如果您正苦于以下问题:C++ ADDWORD函数的具体用法?C++ ADDWORD怎么用?C++ ADDWORD使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ADDWORD函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GETDWORD
// Send server list
bool CLoginServer::pakGetServers( CLoginClient* thisclient, CPacket* P )
{
if( !thisclient->isLoggedIn ) return false;
MYSQL_ROW row;
DWORD servernum = GETDWORD( (*P), 0 );
MYSQL_RES *result = DB->QStore( "SELECT id,name,connected,maxconnections FROM channels WHERE owner=%i and type=2", servernum );
if(result==NULL) return false;
BEGINPACKET( pak, 0x704 );
ADDDWORD ( pak, servernum );
ADDBYTE ( pak, (BYTE)mysql_num_rows( result ) );
while(row = mysql_fetch_row(result))
{
unsigned int status = (atoi(row[2]) * 100) / atoi(row[3]);
ADDWORD( pak, atoi( row[0]));
ADDBYTE( pak, 0 );
ADDWORD( pak, status );
ADDSTRING( pak, row[1]);
ADDBYTE( pak, 0 );
}
DB->QFree( );
thisclient->SendPacket ( &pak );
return true;
}
开发者ID:randybatiquin,项目名称:freerose,代码行数:26,代码来源:loginpackets.cpp
示例2: GetLevelEXP
// check if player can level up
bool CPlayer::CheckPlayerLevelUP( )
{
if (CharInfo->Exp >= GetLevelEXP())
{
CharInfo->Exp -= GetLevelEXP();
Stats->Level++;
Stats->HP = GetMaxHP( );
Stats->MP = GetMaxMP( );
CharInfo->StatPoints += int((Stats->Level * 0.8) + 10);
//if(Stats->Level>=10)
CharInfo->SkillPoints += ((Stats->Level + 2) / 2);
BEGINPACKET( pak, 0x79e );
ADDWORD( pak, clientid );
ADDWORD( pak, Stats->Level );
ADDDWORD( pak, CharInfo->Exp );
ADDWORD( pak, CharInfo->StatPoints );
ADDWORD( pak, CharInfo->SkillPoints );
client->SendPacket( &pak );
RESETPACKET( pak, 0x79e );
ADDWORD( pak, clientid );
GServer->SendToVisible( &pak, this );
SetStats( );
//SendLevelUPtoChar(this);
return true;
}
return false;
}
开发者ID:L3nn0x,项目名称:osirosenew,代码行数:31,代码来源:playerfunctions.cpp
示例3: GETDWORD
// Send server list
bool CLoginServer::pakGetServers( CLoginClient* thisclient, CPacket* P )
{
if( !thisclient->isLoggedIn ) return false;
MYSQL_ROW row;
DWORD servernum = GETDWORD( (*P), 0 );
MYSQL_RES *result = DB->QStore( "SELECT id,name,connected,maxconnections FROM channels WHERE owner=%i and type=2", servernum );
if(result==NULL) return false;
BEGINPACKET( pak, 0x704 );
ADDDWORD ( pak, servernum );
ADDBYTE ( pak, (BYTE)mysql_num_rows( result ) );
while(row = mysql_fetch_row(result))
{
UINT connected = atoi(row[2]);
UINT maxconnections = atoi(row[3]);
BYTE id = atoi( row[0] );
string name = row[1];
//BYTE status = (((100 * connected) / maxconnections==0?1:maxconnections) / 5) & 0xff;
unsigned int status = (connected * 100) / maxconnections;
ADDWORD( pak, id );
ADDBYTE( pak, 0 );
ADDWORD( pak, status );
ADDSTRING( pak, name.c_str() );
ADDBYTE( pak, 0 );
}
DB->QFree( );
thisclient->SendPacket ( &pak );
return true;
}
开发者ID:boermansjo,项目名称:KTRose_Server,代码行数:29,代码来源:loginpackets.cpp
示例4: hwmp_add_meshpreq
/*
* Add a Mesh Path Request IE to a frame.
*/
static uint8_t *
hwmp_add_meshpreq(uint8_t *frm, const struct ieee80211_meshpreq_ie *preq)
{
int i;
*frm++ = IEEE80211_ELEMID_MESHPREQ;
*frm++ = sizeof(struct ieee80211_meshpreq_ie) - 2 +
(preq->preq_tcount - 1) * sizeof(*preq->preq_targets);
*frm++ = preq->preq_flags;
*frm++ = preq->preq_hopcount;
*frm++ = preq->preq_ttl;
ADDWORD(frm, preq->preq_id);
IEEE80211_ADDR_COPY(frm, preq->preq_origaddr); frm += 6;
ADDWORD(frm, preq->preq_origseq);
ADDWORD(frm, preq->preq_lifetime);
ADDWORD(frm, preq->preq_metric);
*frm++ = preq->preq_tcount;
for (i = 0; i < preq->preq_tcount; i++) {
*frm++ = preq->preq_targets[i].target_flags;
IEEE80211_ADDR_COPY(frm, preq->preq_targets[i].target_addr);
frm += 6;
ADDWORD(frm, preq->preq_targets[i].target_seq);
}
return frm;
}
开发者ID:Gwenio,项目名称:DragonFlyBSD,代码行数:28,代码来源:ieee80211_hwmp.c
示例5: GETWORD
// Messenger Chat
bool CCharServer::pakMessengerChat ( CCharClient* thisclient, CPacket* P )
{
WORD id = GETWORD((*P),0);
char* message = new char[P->Size-41];
if(message==NULL)
{
Log(MSG_ERROR, "Error allocing memory: pakMessengerChat" );
return false;
}
memcpy( message, &P->Buffer[35], P->Size-41 );
CCharClient* otherclient = (CCharClient*) GetClientByID(id);
if(otherclient!=NULL)
{
BEGINPACKET( pak, 0x7e2 );
ADDWORD ( pak, thisclient->charid );
ADDWORD ( pak, 0x0000 );
ADDSTRING ( pak, thisclient->charname );
UINT namesize = strlen(thisclient->charname);
for (int i=0;i<30-namesize;i++)
ADDBYTE ( pak, 0x00 );
ADDBYTE ( pak, 0x00 );
ADDSTRING ( pak, message );
ADDBYTE ( pak, 0x00 );
otherclient->SendPacket(&pak);
}
delete []message;
return true;
}
开发者ID:TheDgtl,项目名称:osrose,代码行数:29,代码来源:community.cpp
示例6: BEGINPACKET
// Send Levelup To charserver
bool CWorldServer::SendLevelUPtoChar(CPlayer *thisclient)
{
BEGINPACKET( pak, 0x79e );
ADDWORD( pak, thisclient->CharInfo->charid );
ADDWORD( pak, thisclient->Stats->Level );
cryptPacket( (char*)&pak, NULL );
send( csock, (char*)&pak, pak.Size, 0 );
return true;
}
开发者ID:TheDgtl,项目名称:osrose,代码行数:10,代码来源:worldserver.cpp
示例7: Log
void CMap::UpdateArena( CPlayer* thisclient )
{
if(thisclient== NULL || thisclient->Groupga->Groupga == NULL) return;
GAGroup* thisgroup = thisclient->Groupga->Groupga;
int fragments = -1;
for( UINT i=0; i< MonsterList.size();i++)
{
CMonster* thismon = MonsterList.at(i);
if(thismon->team == thisgroup->GroupId && thismon->montype == 3708)
fragments++;
}
Log(MSG_INFO,"called updatearena fragments = %i",fragments);
if(fragments == 7)
{
for(UINT i=0;i<NPCList.size();i++)
{
CNPC* thisnpc = NPCList.at(i);
if(thisnpc->thisnpc->id == 3704 && thisnpc->pos.x > 5160 && thisnpc->pos.x < 5170 && thisnpc->pos.y > 4915 && thisnpc->pos.y < 4925 && thisnpc->team == thisgroup->GroupId)
{
Log(MSG_INFO,"remove wall");
DeleteNPC(thisnpc);
BEGINPACKET( pak, 0x794 );
ADDWORD( pak, thisnpc->clientid );
GServer->SendToVisible( &pak, thisclient );
RESETPACKET( pak, 0x799 );
ADDWORD ( pak, thisnpc->clientid );
ADDWORD ( pak, thisnpc->clientid );
ADDDWORD ( pak, 0 );
ADDDWORD ( pak, 16 );
GServer->SendToVisible( &pak, thisclient );
break;
}
}
BEGINPACKET( pak, 0x7f8 );
ADDSTRING ( pak, "HUD_DawnSea_Destroyed_Gate1" );
ADDBYTE ( pak, 0x00 );
thisgroup->SendToMembers(&pak);
}
if(fragments == 0)
{
for(UINT i=0;i<NPCList.size();i++)
{
CNPC* thisnpc = NPCList.at(i);
if(thisnpc->npctype == 3704 && thisnpc->pos.x == 5167 && thisnpc->pos.x == 4920 && thisnpc->team == thisgroup->GroupId)
DeleteNPC(thisnpc);
break;
}
BEGINPACKET( pak, 0x7f8 );
ADDSTRING ( pak, "HUD_DawnSea_Destroyed_Gate2" );
ADDBYTE ( pak, 0x00 );
thisgroup->SendToMembers(&pak);
}
}
开发者ID:karlseven,项目名称:ROED,代码行数:56,代码来源:mapfunctions.cpp
示例8: BEGINPACKET
// Change messenger status 07 - online | 08 - offline
bool CCharServer::ChangeMessengerStatus (CCharClient* thisclient, CCharClient* otherclient, int status)
{
BEGINPACKET( pak, 0x7e1 );
ADDBYTE ( pak, 0x08 );
ADDWORD ( pak, thisclient->charid );
ADDWORD ( pak, 0x0000 );
ADDBYTE ( pak, status );
otherclient->SendPacket(&pak);
return true;
}
开发者ID:TheDgtl,项目名称:osrose,代码行数:11,代码来源:community.cpp
示例9: hwmp_add_meshrann
/*
* Add a Root Annoucement IE to a frame.
*/
static uint8_t *
hwmp_add_meshrann(uint8_t *frm, const struct ieee80211_meshrann_ie *rann)
{
*frm++ = IEEE80211_ELEMID_MESHRANN;
*frm++ = sizeof(struct ieee80211_meshrann_ie) - 2;
*frm++ = rann->rann_flags;
*frm++ = rann->rann_hopcount;
*frm++ = rann->rann_ttl;
IEEE80211_ADDR_COPY(frm, rann->rann_addr); frm += 6;
ADDWORD(frm, rann->rann_seq);
ADDWORD(frm, rann->rann_metric);
return frm;
}
开发者ID:Gwenio,项目名称:DragonFlyBSD,代码行数:16,代码来源:ieee80211_hwmp.c
示例10: clock
// Delete a monster
bool CMap::DeleteMonster( CMonster* monster, bool clearobject, UINT i )
{
if(monster==NULL) return false;
GServer->ClearClientID( monster->clientid );
if(monster->Position->respawn!=0)
{
CMobGroup* thisgroup = GServer->GetMobGroup( monster->Position->respawn, monster->Position->Map );
if(thisgroup!=NULL)
{
/*if(thisgroup->active >= thisgroup->limit)// reset spawn timer if the spawn is full
thisgroup->lastRespawnTime = clock();*/
//LMA: only if the monster isn't tactical...
if(!monster->is_tactical)
{
thisgroup->active--;
thisgroup->basicKills++;
thisgroup->lastKills++;
}
}
}
if(clearobject)
{
BEGINPACKET( pak, 0x799 );
ADDWORD ( pak, monster->clientid );
ADDWORD ( pak, monster->clientid );
ADDDWORD ( pak, monster->Stats->HP );
ADDDWORD ( pak, 16 );
GServer->SendToVisible( &pak, monster );
}
if(i!=0)
{
MonsterList.erase( MonsterList.begin()+i );
delete monster;
return true;
}
for(UINT i=0;i<MonsterList.size();i++)
{
CMonster* othermon = MonsterList.at(i);
if(othermon==monster)
{
MonsterList.erase( MonsterList.begin()+i );
delete monster;
return true;
}
}
delete monster;
return false;
}
开发者ID:TheDgtl,项目名称:osrose,代码行数:52,代码来源:worldmap.cpp
示例11: BEGINPACKET
// Move a mob (specified point)
void CMonster::MoveTo( fPoint nPos, bool randcircle )
{
if(randcircle) Position->destiny = GServer->RandInCircle( nPos, 5 );
else Position->destiny = nPos;
// Position->lastMoveTime = clock();
BEGINPACKET( pak, 0x797 );
ADDWORD ( pak, clientid );
ADDWORD ( pak, 0x0000 ); // ???
ADDWORD ( pak, Stats->Move_Speed );
ADDFLOAT ( pak, Position->destiny.x*100 );
ADDFLOAT ( pak, Position->destiny.y*100 );
ADDWORD ( pak, 0xcdcd );
ADDBYTE ( pak, 0x01 );
GServer->SendToVisible(&pak, this );
}
开发者ID:osROSE,项目名称:osrose,代码行数:16,代码来源:Monster.cpp
示例12: ClearBattle
// Move a mob (random place)
void CMonster::Move( )
{
Position->destiny = GServer->RandInCircle( Position->source, 10 );
// Position->lastMoveTime = clock();
ClearBattle( Battle );
BEGINPACKET( pak, 0x797 );
ADDWORD ( pak, clientid );
ADDWORD ( pak, 0x0000 );//???
ADDWORD ( pak, Stats->Move_Speed ); //speed
ADDFLOAT ( pak, Position->destiny.x*100 );
ADDFLOAT ( pak, Position->destiny.y*100 );
ADDWORD ( pak, 0xcdcd );
ADDBYTE ( pak, 0x01 );
GServer->SendToVisible(&pak, this);
}
开发者ID:osROSE,项目名称:osrose,代码行数:16,代码来源:Monster.cpp
示例13: hwmp_add_meshprep
/*
* Add a Mesh Path Reply IE to a frame.
*/
static uint8_t *
hwmp_add_meshprep(uint8_t *frm, const struct ieee80211_meshprep_ie *prep)
{
*frm++ = IEEE80211_ELEMID_MESHPREP;
*frm++ = sizeof(struct ieee80211_meshprep_ie) - 2;
*frm++ = prep->prep_flags;
*frm++ = prep->prep_hopcount;
*frm++ = prep->prep_ttl;
IEEE80211_ADDR_COPY(frm, prep->prep_targetaddr); frm += 6;
ADDWORD(frm, prep->prep_targetseq);
ADDWORD(frm, prep->prep_lifetime);
ADDWORD(frm, prep->prep_metric);
IEEE80211_ADDR_COPY(frm, prep->prep_origaddr); frm += 6;
ADDWORD(frm, prep->prep_origseq);
return frm;
}
开发者ID:Gwenio,项目名称:DragonFlyBSD,代码行数:19,代码来源:ieee80211_hwmp.c
示例14: BEGINPACKET
//add / remove a Fairy
void CWorldServer::DoFairyStuff(CPlayer* targetclient, int action)
{
BEGINPACKET( pak, 0x7dc );
ADDBYTE( pak, action );
ADDWORD( pak, targetclient->clientid);
SendToVisible( &pak, targetclient );
}
开发者ID:TheDgtl,项目名称:osrose,代码行数:8,代码来源:ServerFunctions.cpp
示例15: BEGINPACKET
// Erase a object from the user
bool CPlayer::ClearObject( unsigned int otherclientid )
{
BEGINPACKET( pak, 0x794 );
ADDWORD( pak, otherclientid );
client->SendPacket( &pak );
return true;
}
开发者ID:L3nn0x,项目名称:osirosenew,代码行数:8,代码来源:playerfunctions.cpp
示例16: GETDWORD
bool CCharServer::pakDownloadCM ( CCharClient* thisclient, CPacket* P )
{
unsigned int clanid = GETDWORD((*P), 0 );
MYSQL_RES* result = DB->QStore("SELECT logo FROM list_clan WHERE id=%i",clanid );
if(result==NULL) return true;
if(mysql_num_rows(result)!=1) return true;
MYSQL_ROW row = mysql_fetch_row(result);
unsigned int cmid = atoi(row[0]);
DB->QFree( );
char filename[30];
sprintf( filename, "clanmark/%u.cm", cmid );
FILE* fh = fopen( filename, "rb" );
if(fh==NULL)
{
Log( MSG_WARNING, "Invalid clanmark ID %i", cmid );
return true;
}
CClans* thisclan = GetClanByID(thisclient->clanid);
BEGINPACKET( pak, 0x7e7 );
ADDDWORD ( pak, clanid );
while(!feof(fh))
{
unsigned char charvalue = '\0';
fread( &charvalue, 1 , 1, fh );
ADDBYTE( pak, charvalue );
}
ADDWORD( pak,0);
thisclient->SendPacket( &pak );
fclose(fh);
return true;
}
开发者ID:L3nn0x,项目名称:osirosenew,代码行数:31,代码来源:clan.cpp
示例17: clock
// Teleport player to this map and this coord.
bool CMap::TeleportPlayer( CPlayer* player, fPoint coord, bool TelePassenger )
{
GServer->MapList.Index[player->Position->Map]->RemovePlayer( player, false );
player->Position->Map = id;
player->Position->current = coord;
player->Position->destiny = coord;
player->Session->inGame = false;
player->Position->lastMoveTime = clock();
if(player->Stats->HP<1)player->Stats->HP=player->Stats->MaxHP * 10 / 100;
if(!allowpat || !TelePassenger)
{
if(!allowpat)
player->Status->Stance=0x03;
player->Ride->Drive = false;
player->Ride->charid= 0;
player->Ride->Ride = false;
}
AddPlayer( player );
BEGINPACKET( pak, 0x07a8 );
ADDWORD ( pak, player->clientid );
ADDWORD ( pak, player->Position->Map );
ADDFLOAT ( pak, player->Position->current.x*100 );
ADDFLOAT ( pak, player->Position->current.y*100 );
ADDWORD ( pak, (player->Status->Stance==0x04?0x0201:0x0001) );
player->client->SendPacket( &pak );
if( player->Ride->Drive && player->Ride->charid!=0 )
{
CPlayer* otherclient = GServer->GetClientByCID( player->Ride->charid );
if( otherclient!=NULL )
{
if(TelePassenger)
{
TeleportPlayer( otherclient, coord );
}
else
{
otherclient->Ride->Drive = false;
otherclient->Ride->charid= 0;
otherclient->Ride->Ride = false;
}
}
}
GServer->pakClearUser( player );
GServer->ClearClientID( player->clientid );
player->RestartPlayerVal( );
return true;
}
开发者ID:RavenX8,项目名称:osirose,代码行数:48,代码来源:mapfunctions.cpp
示例18: GetLevelEXP
// check if player can level up
bool CPlayer::CheckPlayerLevelUP( )
{
if (CharInfo->Exp >= GetLevelEXP())
{
CharInfo->Exp -= GetLevelEXP();
Stats->Level++;
Stats->HP = GetMaxHP( );
Stats->MP = GetMaxMP( );
CharInfo->StatPoints += int((Stats->Level*0.8)+10);
// Proper skill point distribution for Pre-Evo
switch (Stats->Level) {
case 10:
case 14:
CharInfo->SkillPoints += 2;
break;
case 18:
CharInfo->SkillPoints += 3;
break;
case 22:
CharInfo->SkillPoints += 4;
break;
}
// 5 skill points every 4 levels from 22
if (Stats->Level > 22 && Stats->Level < 99 && ((Stats->Level - 22) % 4) == 0)
CharInfo->SkillPoints += 5;
// 5 skill points every 2 levels from 98
if (Stats->Level > 98 && (Stats->Level % 2) == 0)
CharInfo->SkillPoints += 5;
BEGINPACKET( pak, 0x79e );
ADDWORD( pak, clientid );
ADDWORD( pak, Stats->Level );
ADDDWORD( pak, CharInfo->Exp );
ADDWORD( pak, CharInfo->StatPoints );
ADDWORD( pak, CharInfo->SkillPoints );
client->SendPacket( &pak );
RESETPACKET( pak, 0x79e );
ADDWORD( pak, clientid );
GServer->SendToVisible( &pak, this );
SetStats( );
//SendLevelUPtoChar(this);
return true;
}
return false;
}
开发者ID:osROSE,项目名称:osprose,代码行数:47,代码来源:playerfunctions.cpp
示例19: BEGINPACKET
// convert a monster to other
CMonster* CMap::ConverToMonster( CMonster* monster, UINT newmontype, bool heal )
{
CNPCData* thisnpc = GServer->GetNPCDataByID( newmontype );
if(thisnpc==NULL)// invalid type
return NULL;
monster->montype = newmontype;
monster->thisnpc = thisnpc;
monster->SetStats( );
if(heal)
monster->Stats->HP = monster->Stats->MaxHP;
BEGINPACKET( pak, 0x774 );
ADDWORD ( pak, monster->clientid );
ADDWORD ( pak, newmontype );
GServer->SendToVisible( &pak, monster );
monster->OnSpawn( false );
return monster;
}
开发者ID:PurpleYouko,项目名称:KTRose_Server,代码行数:18,代码来源:mapfunctions.cpp
示例20: GetClanByID
// Send Clan information
bool CCharServer::SendClanInfo (CCharClient* thisclient)
{
if( thisclient->clanid > 0 )
{
CClans *thisclan = GetClanByID(thisclient->clanid);
if(thisclan!=NULL)
{
BEGINPACKET( pak, 0x7e0);
ADDBYTE ( pak, 0x33);//0x33 you have invited to clan
ADDWORD ( pak, thisclan->id);// clan id
ADDBYTE ( pak, 0x00);//
ADDBYTE ( pak, 0x00);
ADDWORD ( pak, thisclan->back);//Clan Background
ADDWORD ( pak, thisclan->logo);//Clan logo
ADDBYTE ( pak, thisclan->grade);//Clan grade
ADDBYTE ( pak, thisclient->clan_rank);// Clan rank (0 = red rokie / 6 = master)
ADDDWORD ( pak, thisclan->cp);//Clan Points
ADDDWORD ( pak, 0x00000064);
ADDDWORD ( pak, 0x00000000); //Clan found
ADDDWORD ( pak, 0x00000000);
ADDBYTE ( pak, 0x01);
for(int i=34;i<156;i++)
ADDBYTE ( pak, 0x00);
ADDWORD ( pak, 0x0000);
ADDBYTE ( pak, 0x00);
ADDSTRING ( pak, thisclan->name);//Clan Name
ADDBYTE ( pak, 0x00);
ADDSTRING ( pak, thisclan->slogan);//Clan slogan
ADDBYTE ( pak, 0x00);
ADDSTRING ( pak, thisclan->news);//Clan news
ADDBYTE ( pak, 0x00);
thisclient->SendPacket(&pak);
//Put the player online in clan
for(UINT i=0;i<thisclan->ClanMembers.size();i++)
{
CClanMembers* ClanMember = thisclan->ClanMembers.at( i );;
CCharClient* otherclient = GetClientByID( ClanMember->id );
if(otherclient!=NULL)
ChangeClanStatus (thisclient, otherclient, thisclient->channel);//send channel here
}
}
}
return true;
}
开发者ID:L3nn0x,项目名称:osirosenew,代码行数:46,代码来源:clan.cpp
注:本文中的ADDWORD函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论