📄 op_chr_status.cpp
字号:
#include "StdAfx.h"
#include "main.h"
#include "CItem.h"
#include "Map.h"
#include "scrp_exe.h"
#ifdef _GAME_SERVER_
#include "OP_Magic.h"
#endif
#define NUM_OF_RACE 9
#define NUM_OF_KIND 8
extern CItem_Weapon CWeapon[] ;
//////////////////////////////////////////////////////////////
///
///
extern int calcAC( CHARLIST *ch );
#ifdef _GAME_SERVER_
extern int IsHePK( int id );
#endif
//////////////////////////////////////////////////////////////
///
///
// SP 家厚 包访 抛捞喉
// 辆练喊, 惑怕(傈捧, 厚傈捧, 泪 殿狼 惑怕俊 蝶扼)
char sp_consume_tbl[NUM_OF_RACE][NUM_OF_KIND]= { -5, -3, 1, 15, -8, -5, 1, 20,
-6, -3, 1, 15, -6, -2, 2, 18,
-4, -2, 1, 15, -6, -3, 1, 15,
-8, -5, 1, 20, -5, -3, 1, 15,
-4, -4, 2, 15, -4, -4, 3, 15,
-5, -3, 1, 20, -6, -4, 3, 25,
-1, -1, 1, 5, -1, -1, 1, 6,
-3, 0, 2, 10, -4, 0, 2, 10,
-1, 0, 1, 3, -1, 0, 1, 3 } ;
// SP焊沥 包访 抛捞喉
char sp_ttt_corr_tbl[11]= {6, 8, 1, 13, 16, 19, 22, 25, 28, 31, 34 } ; // use the result of divide it by 10
char sp_weight_corr_tbl[10]= {1, 1, 1, 1, 1, 12, 14, 16, 18, 2 } ; // use the result of divide it by 10
// 付过狼 某胶泼 焊沥 抛捞喉 DAMAGE(%)
// 某胶泼 矫埃 - 泅饭骇 + 夸备饭骇
char spell_efficent_tbl[10]= {6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } ; // use the result of divide it by 10
// 氓栏肺 嚼垫啊瓷茄 付过 俺荐.
// index= (int)(INT-10) / 8
char spell_per_int_tbl[9]= {8, 17, 37, 48, 60, 73, 87, 102, 116 } ;
// 巩凯扁
char break_lock_tbl[20]= {1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 } ;
// 艰芒混 戎扁
char break_bar_tbl[20]= {0, 0, 0, 1, 2, 3, 7, 9, 10, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72 } ;
// 捞悼加档 0~25, 26~50, 51~75, 76~99
// index= (int)((MoveP-1) / 25)
char walk_per_round[4]= {2, 3, 4, 5 } ;
char run_per_round[4]= {4, 5, 6, 7 } ;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// User Functions Declaration...
///
int InitPartyMemberServerToServer( CHARLIST *ch ); // 捞抚父 叼厚俊 历厘窍绊 捞抚父 波郴柯促.
int EndsetPartyMenberForUpdate( CHARLIST *ch );
int SetMySkill( CHARLIST *ch ); // 老窜 扁夯利栏肺 舅酒具窍绰 胶懦 悸
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// User Functions.
///
void SendLevelUpMsgAndPoint( CHARLIST *chr ) // 1217
{
t_packet p;
p.h.header.type= CMD_LEVELUP_POINT;
{
//< CSD-010907
p.u.server_levelup_point.idServer = chr->server_id;
p.u.server_levelup_point.nPoint = (BYTE )chr->reserved_point;
p.u.server_levelup_point.nLife = chr->Hp;
//> CSD-010907
}
p.h.header.size= sizeof( t_server_levelup_point );
QueuePacket(connections, chr->server_id, &p, 1);
#ifdef _GAME_SERVER_
CastMe2Other( chr->server_id, &p );
#endif
}
// 矫埃寸 1锅 龋免
void calcHungry(CHARLIST *chr)
{
double lev_corr, disease_corr, t;
int h= 0, weight_index ;
if(chr->Peacests) { // 傈捧矫
if(chr->Level < 20) {
lev_corr= 1 + (chr->Level - 20) * 0.02 ;
}
else {
lev_corr= 1 + (chr->Level - 20) * 0.03 ;
}
weight_index= (int)chr->Weight / chr->MaxWeight * 10 ;
disease_corr= 1.0 ;
t = sp_consume_tbl[chr->Race][0] * lev_corr * sp_weight_corr_tbl[weight_index] / 10 + disease_corr ;
chr->Hungry-= (short)t;
if( chr->Hungry < 0 ) chr->Hungry = 0;
}
else { // 扁贱荤侩? 绒侥? 荐搁?
}
}
int calcMovP( CHARLIST *ch )
{
int t = ch->MoveP;
return t;
}
// 唱捞俊 蝶弗 阿 公扁扁贱喊 胶懦 槛访档狼 惑铰加档狼 瞒捞 10栏肺 唱穿绢 荤侩
char tac_inc_by_age_tbl[12][37]= { 1, 13, 12, 13, 13, 12, 12, 14, 13, 15, 14, 12, 10, 12, 10, 10, 10, 10, 11, 10, 10, 10, 10, 11, 10, 10, 10, 10, 10, 11, 10, 10, 10, 10, 10, 10, 1,
1, 10, 10, 11, 11, 12, 12, 13, 13, 12, 14, 13, 11, 10, 10, 10, 10, 10, 10, 11, 10, 10, 10, 10, 11, 12, 12, 11, 13, 11, 14, 10, 10, 10, 10, 10, 1,
1, 10, 10, 10, 10, 11, 13, 14, 15, 15, 15, 11, 12, 10, 10, 13, 10, 10, 10, 11, 10, 11, 10, 10, 10, 10, 10, 10, 11, 10, 10, 10, 10, 10, 10, 10, 1,
1, 10, 10, 10, 10, 11, 10, 10, 10, 10, 10, 10, 11, 15, 13, 12, 14, 11, 11, 12, 10, 10, 10, 10, 10, 13, 11, 12, 10, 10, 10, 11, 10, 10, 10, 10, 1,
1, 10, 10, 10, 10, 12, 10, 10, 10, 10, 10, 10, 10, 15, 14, 11, 13, 10, 12, 11, 10, 10, 10, 10, 10, 14, 10, 13, 10, 10, 10, 10, 10, 11, 11, 10, 1,
1, 12, 10, 10, 11, 13, 12, 10, 10, 10, 10, 10, 10, 11, 10, 10, 10, 10, 10, 12, 14, 10, 12, 13, 12, 12, 13, 13, 12, 10, 10, 10, 10, 10, 11, 10, 1,
1, 10, 11, 10, 11, 10, 10, 10, 10, 11, 10, 10, 10, 10, 10, 12, 10, 10, 10, 14, 15, 14, 15, 15, 14, 14, 15, 10, 10, 10, 11, 10, 10, 10, 10, 10, 1,
1, 10, 11, 10, 10, 10, 10, 10, 11, 10, 12, 10, 10, 10, 10, 10, 10, 10, 10, 11, 10, 10, 11, 10, 12, 13, 15, 14, 14, 15, 15, 11, 10, 10, 10, 11, 1,
1, 10, 10, 11, 10, 10, 10, 10, 11, 10, 13, 13, 12, 15, 14, 12, 10, 10, 10, 10, 10, 10, 11, 10, 10, 11, 13, 12, 12, 11, 10, 10, 11, 10, 10, 10, 1,
1, 10, 10, 10, 10, 11, 10, 10, 11, 10, 10, 14, 12, 13, 14, 15, 14, 13, 12, 11, 10, 10, 10, 11, 10, 10, 10, 10, 10, 11, 10, 10, 10, 10, 10, 10, 1,
1, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 10, 10, 11, 12, 13, 12, 12, 14, 13, 12, 11, 12, 13, 11, 10, 10, 10, 10, 11, 11, 10, 11, 10, 1,
1, 10, 10, 10, 10, 11, 10, 10, 10, 11, 10, 10, 13, 12, 14, 13, 14, 11, 10, 10, 10, 10, 10, 12, 13, 12, 13, 14, 12, 10, 10, 10, 10, 11, 10, 10, 1
} ;
// 流诀俊 蝶弗 公扁扁贱喊 槛访档 惑铰沥档 (10栏肺 唱穿绢 荤侩)
char tac_inc_by_class_tbl[5][12]= { 15, 15, 15, 15, 1, 1, 1, 1, 15, 15, 15, 1,
8, 10, 8, 8, 8, 8, 15, 15, 8, 8, 1, 8,
1, 1, 8, 8, 15, 15, 15, 15, 1, 8, 8, 1,
8, 8, 8, 8, 15, 1, 1, 8, 8, 8, 8, 1,
5, 8, 5, 5, 15, 1, 1, 8, 5, 5, 5, 5
} ;
void increaseTacticsSkill(CHARLIST *chr)
{
int skill_index ;
int k ;
int age_index, weapon_type_index ;
double skill_corr ;
k= 1 ;
skill_index= 0 ;
// 胶懦急琶 焊沥
if(chr->Tactics == skill_index) skill_corr= 1.2 ;
else skill_corr= 1.0 ;
if(chr->Age < 15) {
age_index= 0 ;
} else age_index= chr->Age-15;
if(CWeapon[chr->equip[0].item_no].Item_kind < 0)
{
weapon_type_index= 0;
} else weapon_type_index= CWeapon[chr->equip[0].item_no].Item_kind;
double t = k * tac_inc_by_age_tbl[skill_index][age_index]
* tac_inc_by_class_tbl[chr->Race][weapon_type_index] * skill_corr;
chr->tac_skillEXP[skill_index]+= (int)t;
}
void increaseJobSkill(CHARLIST *chr)
{
}
void decreaseJobSkill(CHARLIST *chr)
{
}
void decreaseClassSkill(CHARLIST *chr)
{
}
void increaseClassSkill(CHARLIST *chr)
{
}
int increaseAbility(CHARLIST *chr, t_packet *packet)
{
if(packet->h.header.size < packet->u.mass_data.num * 3 + 1) {
printf("\n increase ability: Size doesn't matching!") ;
return -1 ;
}
int total_inc= 0 ;
int i= 0 ;
for(i= 0 ; i < packet->u.mass_data.num ; i++)
total_inc+= packet->u.mass_data.elements[i].value ;
// 努扼捞攫飘啊 耗柯 刘啊蔼甸狼 醚钦捞 泅犁 巢酒乐绰 盒硅痢荐焊促 腹栏搁 俊矾
if(total_inc > chr->reserved_point) return -1 ;
for(i= 0 ; i < packet->u.mass_data.num ; i++)
switch(packet->u.mass_data.elements[i].var_kind) {
case STR:
chr->Str+= packet->u.mass_data.elements[i].value ;
break ;
case CON:
chr->Con+= packet->u.mass_data.elements[i].value ;
break ;
case DEX:
chr->Dex+= packet->u.mass_data.elements[i].value ;
break ;
case WIS:
chr->Wis+= packet->u.mass_data.elements[i].value ;
break ;
case INT:
chr->Int+= packet->u.mass_data.elements[i].value ;
break ;
case MOVP:
chr->MoveP+= packet->u.mass_data.elements[i].value ;
break ;
case CHA:
chr->Char+= packet->u.mass_data.elements[i].value ;
break ;
case ENDU:
chr->Endu+= packet->u.mass_data.elements[i].value ;
break ;
case MOR:
chr->Moral+= packet->u.mass_data.elements[i].value ;
break ;
case LUCK:
chr->Luck+= packet->u.mass_data.elements[i].value ;
break ;
case WSPS:
chr->wsps+= packet->u.mass_data.elements[i].value ;
break ;
}
chr->reserved_point-= total_inc ;
return total_inc ;
}
int SetItemEmpty( CHARLIST *ch, int item_no ) // 后 牢亥配府俊 酒捞袍阑 积己秦辑 笼绢 持绰促. //1215
{
ItemAttr *item = SearchInv( ch );
if( item ) *item = GenerateItem( item_no ) ;
else return 0;
return 1;
}
extern int SetTactics( int spell_type, int sex, int tac_type ); // 1101 YGI
// 弥檬 某腐磐狼 积己困摹, 扁夯荐摹, Item甸阑 Setting茄促.
void CreateCharacter( t_connection c[], int cn, t_packet *packet) // 001215 YGI
{
CHARLIST *ch = &c[cn].chrlst;
t_client_create_char *p = &packet->u.client_create_char;
memset( ch->Ws, 0, SIZE_OF_WS ); // 付过
memset( ch->Ps, 0, SIZE_OF_PS ); // 脚过
memset( ch->Skill, 0, SIZE_OF_SKILL );
memset( ch->skillexp, 0, SIZE_OF_SKILL_EXP );
memset( ch->tac_skillEXP,0, SIZE_OF_TAC_SKILL_EXP );
memset( var[ cn], 0, SIZE_OF_SCRIPT_VAR ); // 0819 KHS
memset( ch->inv, 0, SIZE_OF_INV ); // 牢亥配府
memset( ch->equip, 0, SIZE_OF_EQUIP ); // 厘馒
memset( ch->quick, 0, sizeof( ItemAttr ) * 7 ); // 狞
memset( ch->bank, 0, SIZE_OF_BANKITEM );
memset( ch->party, 0, SIZE_OF_PARTY );
memset( ch->relation, 0, SIZE_OF_RELATION );
memset( ch->employment, 0, SIZE_OF_EMPLOYMENT );
memset( ch->Item, 0, SIZE_OF_ITEMINDEX );
memset( &ch->handheld, 0, sizeof( ItemAttr )); // 颊(付快胶)俊 甸绊 乐绰
memset( &ch->name_status, 0 ,sizeof( DWORD ) ); // 001219 YGI
memcpy( ch->Name, p->name, 20 );
ch->bAlive = ALIVE_;
ch->Level = 1;
ch->LvUpPoint = 0;
ch->Exp = 0;
ch->LastLoan = 0; // 010608 YGI
ch->Gender = p->gender; // 0:咯磊 1 : 巢磊
ch->Face = p->face;
ch->nGuildCode = 0; // CSD-030324
ch->Job = p->job; // 0:傈荤 1:泵荐 2:档利 3:己流磊 4:付过荤
ch->Class = p->Class;
int nation = GetNationById(c[cn].id); // 1004 YGI
if( nation < 0 ) nation = 0;
ch->name_status.nation = nation;
ch->Race = 0; // 辆练
ch->Tactics = p->tactics;
ch->Condition = 0;
strcpy(ch->MapName, "SCHOLIUM" );
ch->Peacests = 0;
ch->Sight = 12;
ch->BodyR = p->body_r, ch->BodyG = p->body_g, ch->BodyB = p->body_b; // 个 祸彬 R.G.B
ch->ClothR = p->cloth_r, ch->ClothG = p->cloth_g, ch->ClothB = p->cloth_b; // 鹅 祸彬 R.G.B
ch->Age = p->age;
// 010531 KHS
ch->nk[3] = 0; // NK肺 荤侩等促.
ch->nk[4] = 0;
ch->nk[6] = 0;
ch->killmon = 0; // 1拌凯阁胶磐 懦傅胶
ch->killanimal = 0; // 悼拱 懦傅荐
ch->killpc = 0; // 荤恩,NPC 懦傅荐
ch->nPoison = 0;
ch->nCurse = 0;
ch->nFire = 0;
ch->nIce = 0;
ch->nElect = 0;
ch->nHoly = 0;
ch->Spell = p->spell; // 0 : Ws 1 : Ps
//////////////////////////////////////////////////////////////////////////////////
// 郴啊 啊瘤绊 乐绰 酒捞袍.. //0101
if(LocalMgr.IsChangeMoney())//021007 lsw
{
ch->inv[0][0][0] = GenerateItem( 10123, 400);
}
else
{
ch->inv[0][0][0] = GenerateItem( 10029, 400);
}
if(ch->Gender ){ch->equip[WT_ARMOR] = GenerateItem( 8037);}
else{ch->equip[WT_ARMOR] = GenerateItem( 8038);}
ch->accessory[0] = 96;//GetItemView( ch->equip[WT_ARMOR].item_no, ch->Gender ); // 癌渴.
ch->accessory[1] = 0;// 捧备..
ch->accessory[2] = GetItemView( ch->equip[WT_WEAPON].item_no, ch->Gender ); // 漠..
ch->accessory[3] = 0; // 规菩...
ch->mantle = 0; // 011018 KHS 噶肚
int a, b, c1;
int i;
for( i=0; i<2; i++ ) // 器记
{
SearchInv( ch->inv, a, b, c1 );
ch->inv[a][b][c1] = GenerateItem( 4001);
}
for( i=0; i<2; i++ ) // 户
{
SearchInv( ch->inv, a, b, c1 );
ch->inv[a][b][c1] = GenerateItem( 3007);
}
switch( ch->Class ) // 001215 YGI
{
case WARRIOR://如果是战士
{
SetItemEmpty( ch, 4001 );
SetItemEmpty( ch, 4001 );
SetItemEmpty( ch, 6143 );
SetItemEmpty( ch, 6146 );
SetItemEmpty( ch, 6001 );
SetItemEmpty( ch, 6076 );
SetItemEmpty( ch, 6062 );
SetItemEmpty( ch, 6063 );
SetItemEmpty( ch, 6067 );
SetItemEmpty( ch, 6138 );
if(ch->Gender )
{
SetItemEmpty( ch, 6142);
SetItemEmpty( ch, 6214);
SetItemEmpty( ch, 6019);
SetItemEmpty( ch, 6234);
}
else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -