📄 menuserver.cpp
字号:
if( ch && strcmp(ch->Name, name )==0 )
return ch;
return NULL;
}
void SendExitGameWho( int cn ) // 唱尔 悼竿 肝绊 乐绰 荤恩 葛滴甫 茫酒辑 焊郴拎具 窍唱 酒丛 郴啊 肝绊 乐绰 荤恩 6疙俊父 焊郴林唱?
{ //< CSD-030506
CHARLIST *ch = &connections[cn].chrlst;
if (EXCHANGE_STATE_READY != ch->GetExchangeState())
{ // 芭贰吝捞带吧 秒家 矫挪促.
SendExchangeCancel(ch->GetExchangeTargetId(), cn);
}
//< CSD-HK-030828
g_pUserManager->DelMember(cn);
g_pDualManager->DelMember(cn);
const int nGuildCode = ch->GetGuildCode();
if (nGuildCode > 0)
{
g_pGuildManager->DelMember(nGuildCode, cn);
}
if (g_pArenaManager->IsColossusArena())
{
g_pArenaManager->Remove(cn);
}
//> CSD-HK-030828
for( int i=0; i<6; i++ )
{
if( !ch->party[i].On ) continue;
//CHARLIST *gammer = CheckServerIdAndName( ch->party[i].Server_id, ch->party[i].Name );
CHARLIST *gammer = CheckServerName( ch->party[i].Name ); // kyo
if( gammer )
{
for( int j=0; j<6; j++ )
{
if( gammer->party[j].On && !strcmp(gammer->party[j].Name, ch->Name) ) // 弊荤恩档 唱客 悼竿阑 肝篮 荤恩捞扼搁...
{
//gammer->party[j].Server_id = 0;
t_packet packet;
packet.h.header.type = CMD_SERVER_EXIT_GAME;
{
strcpy( packet.u.kein.client_char_name.name, ch->Name );
}
packet.h.header.size = sizeof( k_client_char_name );
QueuePacket(connections, gammer->GetServerID(), &packet, 1);
break;
}
}
}
}
} //> CSD-030506
void SendMyPartyExist(int cn) // 货肺甸绢柯 某腐磐俊霸 颇萍盔捞 乐绰 瘤甫 焊郴霖促.
{ //< CSD-030415
CHARLIST* ch = CheckServerId(cn);
if (!ch)
{
return;
}
for (int i = 0; i < MAX_PARTY_MEMBER; ++i)
{
if (ch->party[i].On)
{
CHARLIST* pParty = CheckServerName(ch->party[i].Name);
if (pParty == NULL)
{
continue;
}
t_packet packet;
packet.h.header.type = CMD_REQ_MY_PARTY;
packet.h.header.size = sizeof(k_client_char_name);
strcpy(packet.u.kein.client_char_name.name, ch->party[i].Name);
QueuePacket(connections, cn, &packet, 1);
}
}
SendPartyJoinOkSet( cn ); // 颇萍盔甸 傈何 炼荤秦辑 焊郴霖促.
} //> CSD-030415
void SendPartyJoinOk( char *name, int cn )
{
t_packet p;
p.h.header.type = CMD_PARTY_JOIN_OK;
{
strcpy(p.u.kein.client_char_name.name, name);
}
p.h.header.size = sizeof( k_client_char_name );
QueuePacket( connections, cn, &p, 1 );
}
int ExistHe( char *name )//020903 lsw
{ //< CSD-030314
return g_pUserManager->GetServerID(name);
} //> CSD-030314
int ExistConnectingHe( char *name )
{ //< CSD-030314
return -1;
} //> CSD-030314
void RecvReleaseParty( char *name, int cn )
{
CHARLIST *ch = CheckServerId( cn );
if( !ch ) return;
int party_id = ExistHe( name);
if( party_id > 0 )
{
t_packet p;
p.h.header.type = CMD_PARTY_JOIN_RELEASE;
{
strcpy(p.u.kein.client_char_name.name, ch->Name);
}
p.h.header.size = sizeof( k_client_char_name );
QueuePacket( connections, party_id, &p, 1 );
}
}
void SendPartyJoinOkSet( int cn ) // 立加茄 某腐磐狼 颇萍盔 悸..
{
CHARLIST *ch = CheckServerId( cn );
if( !ch ) return;
for( int i=0; i<6; i++)
{
if( !ch->party[i].On ) continue;
int id = ExistHe( ch->party[i].Name );
if( id>0 ) // 泅犁 立加秦 乐栏搁
{
CHARLIST *pa = &connections[id].chrlst;
if( !pa ) return;
for( int j=0; j<6; j++ )
{
if( !strcmp( ch->Name, pa->party[j].Name ) )
{
SendPartyJoinOk( ch->party[i].Name, cn ); // 刚历 皋矫瘤甫 焊辰 仇俊霸 ok甫 焊郴林绊
SendPartyJoinOk( ch->Name, pa->GetServerID()); // 惑措祈档 白俊 立加秦 乐栏搁 ok甫 焊郴霖促.
break;
}
}
// if( j==6 ) RecvReleaseParty( ch->party[i], cn ); // 弊 仇篮 唱客 悼竿阑 肝绊 乐瘤 臼促...
}
// else // 泅犁 立加秦 乐瘤 臼促搁..
// {
// char you_party[6][31];
// get_BinaryData_Party( (UCHAR **)you_party, ch->party[i] );
// for( int j=0; j<6; j++ )
// {
// if( !strcmp( ch->Name, you_party[j] ) )
// {
// SendPartyJoinOk( ch->party[i], cn );
// break;
// }
// }
// if( j== 6) RecvReleaseParty( ch->party[i], cn );
// }
}
}
void SendServerEachItem( const ItemAttr *item, const CHARLIST *ch )
{
if( !item ) return;
for( int a=0; a<3; a++ )
for( int b=0; b<3; b++ )
for( int c=0; c<8; c++ )
{
if( &ch->inv[a][b][c] == item )
{
POS pos;
SetItemPos( INV, a, b, c, &pos );
SendServerEachItem( &pos, item, ch->GetServerID());
return;
}
}
}
void SendServerEachItem( const POS *pos, const ItemAttr *item, const int cn ) // 弊磊府俊 嫩 麦绢辑 蔼阑 焊郴霖促.
{
CHARLIST *ch = CheckServerId( cn );
if( !ch ) return;
t_packet packet;
packet.h.header.type = CMD_SERVER_EACH_ITEM;
{
packet.u.kein.server_item.item_pos = *pos;
packet.u.kein.server_item.item_attr = *item;
}
packet.h.header.size = sizeof( K_ITEM );
QueuePacket(connections, cn, &packet, 1);
}
void SendAbilityOpen( const int cn )
{
CHARLIST *ch = ::CheckServerId(cn);
if( !ch )
{
return;
}
t_packet packet;
packet.h.header.type = CMD_OPEN_ABILITY;
{
packet.u.kein.server_resist.naBasicResist[RT_POISON] = ch->GetBasicResist(RT_POISON);
packet.u.kein.server_resist.naBasicResist[RT_CURSE] = ch->GetBasicResist(RT_CURSE);
packet.u.kein.server_resist.naBasicResist[RT_HOLY] = ch->GetBasicResist(RT_HOLY);
packet.u.kein.server_resist.naBasicResist[RT_FIRE] = ch->GetBasicResist(RT_FIRE);
packet.u.kein.server_resist.naBasicResist[RT_ICE] = ch->GetBasicResist(RT_ICE);
packet.u.kein.server_resist.naBasicResist[RT_ELECT] = ch->GetBasicResist(RT_ELECT);
packet.u.kein.server_resist.naExtentionResist[RT_POISON] = ch->GetExtPoisonByItem();//酒捞袍俊 狼秦 歹秦瘤绰 付过规绢仿
packet.u.kein.server_resist.naExtentionResist[RT_CURSE] = ch->GetExtCurseByItem() ;
packet.u.kein.server_resist.naExtentionResist[RT_HOLY] = ch->GetExtHolyByItem() ;
packet.u.kein.server_resist.naExtentionResist[RT_FIRE] = ch->GetExtFireByItem() ;
packet.u.kein.server_resist.naExtentionResist[RT_ICE] = ch->GetExtIceByItem() ;
packet.u.kein.server_resist.naExtentionResist[RT_ELECT] = ch->GetExtElectByItem();
}
packet.h.header.size = sizeof(k_server_resist);
QueuePacket(connections, cn, &packet, 1);
}
void SendSubtractMoney( DWORD money, int cn )
{
return;
t_packet packet;
packet.h.header.type = CMD_SUBTRACT_MONEY;
{
packet.u.kein.server_money.money = money;
}
packet.h.header.size = sizeof(k_server_money);
QueuePacket(connections, cn, &packet, 1);
}
void SendAddMoney( DWORD money, int cn )
{
t_packet packet;
packet.h.header.type = CMD_ADD_MONEY;
{
packet.u.kein.server_money.money = money;
}
packet.h.header.size = sizeof(k_server_money);
QueuePacket(connections, cn, &packet, 1);
}
//////////////////////////////////////////////////////////////
//
// cheat command // learn magic, learn skill
//
////////////////////////////////////////////////////////////
void RecvLearnAll( int cn )
{
CHARLIST *ch = CheckServerId( cn );
if( !ch ) return;
for( int i=0; i<200; i++ )
{
ch->Skill[i] = true;
ch->Ws[i] = true;
ch->Ps[i] = true;
}
}
void RecvLearnAllNot( int cn )
{
CHARLIST *ch = CheckServerId( cn );
if( !ch ) return;
for( int i=0; i<200; i++ )
{
ch->Skill[i] = false;
ch->Ws[i] = false;
ch->Ps[i] = false;
}
}
///////////////////////////////////////////////////////////////
// 某腐磐 贸澜 立加沁阑锭 涝绊 乐绰 酒捞袍...棺 咯矾啊瘤 贸府
int CheckCurrStats( CHARLIST *ch ) // 010521 YGI
{
ch->Money = GetMoneyByItem( ch );
ch->itemweight = GetTotalItemWeight( ch );
ch->Tactics_para = SetTactics( ch->Spell, ch->Gender, ch->Tactics );
if (ch->IsDead())
{
ch->bAlive = DEAD_;
ch->SetState(CON_DEATH);
ch->viewtype = VIEWTYPE_GHOST_;
}
else
{
ch->bAlive = ALIVE_;
ch->SetState(CON_NORMAL);
ch->viewtype = VIEWTYPE_NORMAL_;
}
EquipItem( ch );
ch->pkid = -1; // 唱吝俊 啊摹包栏肺 官柴...... 弥家俊 PK甫 窍搁 弊狼 ID甫 啊柳促. ...
ch->can_memorize_time = g_curr_time; // 皋葛扼捞令 且 荐 乐绰 矫埃 技泼
return 1;
}
void SendServerItemAttr( short int cn, int type, POS pos, ItemAttr *item )
{
short int header_type;
switch( type )
{
case IATTR_DURATION : header_type=CMD_IATTR_DURATION ; break;
case IATTR_LIMIT : header_type=CMD_IATTR_LIMIT ; break;
case IATTR_ATTR : header_type=CMD_IATTR_ATTR ; break;
case IATTR_ID : header_type=CMD_IATTR_ID ; break;
case IATTR_RESERVED0: header_type=CMD_IATTR_RESERVED0 ; break;
case IATTR_RESERVED1: header_type=CMD_IATTR_RESERVED1 ; break;
default : return;
}
t_packet packet;
packet.h.header.type = header_type;
{
packet.u.kein.server_item_attr.pos = pos;
packet.u.kein.server_item_attr.attr = item->attr[type];
}
packet.h.header.size = sizeof( k_server_item_attr );
QueuePacket(connections, cn, &packet, 1);
}
// 020428 YGI acer
// 酒捞袍 昏力 傈价 窃荐 // 酒捞袍捞 掂饭捞记捞 力肺咯辑 何辑龙版款 type阑 官槽促.
int SendDeleteItem( ItemAttr *pItem, POS *pos, CHARLIST *ch, bool broken )
{
if( pItem )
{
if( pos->type == EQUIP )
{
CItem *t = ItemUnit( *pItem );
if( t ) t->ReleaseItem( ch );
}
if( pItem->attr[IATTR_RARE_MAIN])
{
const int nRare = pItem->attr[IATTR_RARE_MAIN];
Send_RareItemMakeLog(ch->GetServerID(), pItem->item_no,-1,
((LPRareMain)&nRare)->grade,((LPRareMain)&nRare)->soksung1,((LPRareMain)&nRare)->soksung2,
((LPRareMain)&nRare)->soksung3,0,0,0,pItem->attr[IATTR_RARE_MAIN],pItem->attr[IATTR_LIMIT],0,-1,-1,0,0,0,0,0,0); //020730 lsw
}
}
t_packet p;
int type;
if( broken ) type = CMD_DELETE_ITEM_BY_DURATION;
else type = CMD_DELETE_ITEM;
p.h.header.type = type;
{
p.u.kein.server_delete_item.item_pos = *pos;
}
p.h.header.size = sizeof( k_server_delete_item );
QueuePacket(connections, ch->GetServerID(), &p, 1);
return DeleteItem( pItem );
}
void SendServerAc( int cn )
{ //< CSD-020821
CHARLIST *ch = CheckServerId( cn );
if (!ch) return;
t_packet packet;
packet.h.header.type = CMD_REQ_AC;
packet.h.header.size = sizeof(k_server_ac);
packet.u.kein.server_ac.ac = ch->GetExtendAc();
QueuePacket(connections, cn, &packet, 1);
} //> CSD-020821
void SendServerDmg( int cn )
{
CHARLIST *ch = CheckServerId( cn );
if( !ch ) return;
t_packet packet;
packet.h.header.type = CMD_REQ_DMG;
packet.h.header.size = sizeof(k_server_ac);
packet.u.kein.default_int = ch->CalcPhysicalStrikingPower();
QueuePacket(connections, cn, &packet, 1);
}
inline void CallClient( short int id, short int type )
{
t_packet packet;
packet.h.header.type = type;
packet.h.header.size = 0;
QueuePacket(connections, id, &packet, 1);
}
void SendPacketDefault( int type, void *msg, int size, short int cn )
{
t_packet packet;
packet.h.header.type = type;
packet.h.header.size = 0;
if( msg && size)
{
memcpy( packet.u.data, msg, size );
packet.h.header.size = size;
}
QueuePacket(connections, cn, &packet, 1);
}
void SendServerKillMon( short int cn )
{
CHARLIST *ch = CheckServerId( cn );
if( !ch ) return;
t_packet packet;
packet.h.header.type = CMD_SERVER_KILLMON;
{
packet.u.kein.server_killmon.killmon = ch->killmon;
}
packet.h.header.size = sizeof(k_server_killmon);
QueuePacket(connections, cn, &packet, 1);
}
/// 0212 YGI /////////
int SetTactics( int spell_type, int sex, int tac_type ) // 某腐磐 皋捞农且版快 急琶茄 琶平胶甫 角力 硅凯梅磊肺 官操绰 风凭..
{
int tac_con[2][12] = {
{ CRAPPLE_, SWORD_, ARCHERY_, FENCING_, MACE_, PIERCE_, WHIRL_, HURL_, PARRYING_, MAGERY_, }, // 咯磊
{ CRAPPLE_, SWORD_, ARCHERY_, PARRYING_, MACE_, PIERCE_, WHIRL_, HURL_, MAGERY_, D_SWORD_, D_MACE_ }, // 巢磊
};
int ret = tac_con[sex][tac_type];
if( spell_type == PRIEST_SPELL && ret == MAGERY_ ) ret = ORISON_;
return ret;
}
/*
void LearnSkillOfJob( int inc_job, CHARLIST *ch)
{
int skill_mother[32][2] = { {1,3}, {3,5}, {5,8}, {8,10}, {10,16}, {16,19}, {19,21}, {21,25}, {25,28}, {28,32},
{32,34}, {34,35}, {35,38}, {38,42}, {42,43}, {43,44}, {44,45}, {45,48}, {48,50}, {50,53},
{53,55}, {55,56}, {56,57}, {57,64}, {64,67}, {67,73}, {73,75}, {75,76}, {76,78}, {78,86},
{86,87}, {87,101} };
int min = skill_mother[inc_job][0];
int max = skill_mother[inc_job][1];
for( int i=0; i<max; i++ ) ch->Skill[i] = 1;
}
*/
/*
int SendPartyInfo2( short int type, char ct, short int cn )
{
CHARLIST *ch = CheckServerId( cn );
if( !ch ) return -1;
t_packet packet;
packet.h.header.type = CMD_SERVER_PARTY;
{
packet.u.kein.party_info.type = (short) type;
packet.u.kein.party_info.index = (char) ct;
strcpy( packet.u.kein.party_info.m_Name, ch->party[ct].Name);
packet.u.kein.party_info.m_Gender = (char) ch->party[ct].Gender;
packet.u.kein.party_info.m_ImageNo = (short) ch->party[ct].Face;
packet.u.kein.party_info.m_Lv = (char) ch->party[ct].Level;
packet.u.kein.party_info.m_Str = ch->party[ct].Str;
packet.u.kein.party_info.m_Class = (char) ch->party[ct].Class;
packet.u.kein.party_info.m
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -