📄 skill.cpp
字号:
SendNPC_Parameter( n->GetServerID(), NPC_PARAMETER_PATTERNTYPE, n->patterntype );
}
}
}
}
}
void RefreshSkillMapTable( void )
{
//<! BBD 040311
/* static int ttime;
int g_y, g_mo, g_d, g_h, g_mi, g_se; // 霸烙矫埃
CurrentGameDate( g_curr_time*6, &g_y, &g_mo, &g_d, &g_h, &g_mi, &g_se );
int sub = g_h-ttime;
if( sub < 0 ) sub=sub+24;
if( sub < 6 ) return; //1矫埃 付促 refresh
ttime = g_h;
t_earthpower *ep;
ep = &EarthPower;
int i;
static int iRefreshCount=0;
if(iRefreshCount>3) iRefreshCount=0;
for( i = iRefreshCount ; i < ep->miningcount ; i=i+4) ep->mining[i] =ep->mining_old[i];
for( i = iRefreshCount ; i < ep->fishingcount ; i=i+4) ep->fishing[i] =ep->fishing_old[i];
for( i = iRefreshCount ; i < ep->cuttingcount ; i=i+4) ep->cutting[i] =ep->cutting_old[i];
for( i = iRefreshCount ; i < ep->diggingcount ; i=i+4) ep->digging[i] =ep->digging_old[i];
iRefreshCount++;*/
// 捞傈狼 鸥捞赣甫 脚汾且荐 绝菌促. 弊贰辑 窃荐郴何甫 狙荤府 促矫 备己窃
static int old_hour = g_hour;
static int old_min = g_min;
static bool bReq = false; // 悼立夸没阑 1锅父 窍扁困茄 敲饭弊
int sub = g_hour-old_hour;
if( sub < 0 ) sub=sub+24;
if( sub != 4 || old_min != g_min) // 4 矫埃 汝矾具瘤 关率栏肺 柳涝 4矫埃付促 refresh // BBD 040322
{
int min = old_min - 1;
if(min < 0) min += 60;
if(!bReq && sub == 4 && min == g_min) // 捞傈矫埃栏肺何磐 4矫埃 儒弗 矫埃狼 1盒傈 悼立阑 夸没茄促 // BBD 040322
{
RequestUsercountToProxy(); // 悼立夸没
bReq = true;
}
return; // 6矫埃捞 臼夌栏搁 府畔
}
bReq = false;
old_hour = g_hour;
old_min = g_min;
t_earthpower *ep;
ep = &EarthPower;
float Rate = GetResourceRate(g_UsercountInServerSet); // 磊盔硅啦阑 备秦柯促
MyLog(0, "Resetting ResourceRate = %.1f, cause UsercountInServerSet = %d", Rate, g_UsercountInServerSet);
MyLog(0, "mine[0] orign:%d\tbefore:%d\tcurrent:%d", ep->mining_old[0], ep->mining[0], (int)(ep->mining_old[0] * Rate));
MyLog(0, "fishing[0] orign:%d\tbefore:%d\tcurrent:%d", ep->fishing_old[0], ep->fishing[0], (int)(ep->fishing_old[0] * Rate));
MyLog(0, "cutting[0] orign:%d\tbefore:%d\tcurrent:%d", ep->cutting_old[0], ep->cutting[0], (int)(ep->cutting_old[0] * Rate));
MyLog(0, "digging[0] orign:%d\tbefore:%d\tcurrent:%d", ep->digging_old[0], ep->digging[0], (int)(ep->digging_old[0] * Rate));
int i;
static int iRefreshCount=0;
if(iRefreshCount>3) iRefreshCount=0;
for( i = iRefreshCount ; i < ep->miningcount ; i=i+4)
{
ep->mining[i] = (int)(ep->mining_old[i] * Rate);
}
for( i = iRefreshCount ; i < ep->fishingcount ; i=i+4)
{
ep->fishing[i] = (int)(ep->fishing_old[i] * Rate);
}
for( i = iRefreshCount ; i < ep->cuttingcount ; i=i+4)
{
ep->cutting[i] = (int)(ep->cutting_old[i] * Rate);
}
for( i = iRefreshCount ; i < ep->diggingcount ; i=i+4)
{
ep->digging[i] = (int)(ep->digging_old[i] * Rate);
}
iRefreshCount++;
//> BBD 040311
}
short nSadTime = -1;
void UpdateSadonixCount()
{
if( MapInfo[MapNumber].port == NATION_MANAGE_SERVER )
{
if( nSadTime == -1 )
{
nSadTime = g_wday*100 + g_hour;
}
const short tempnSadTme = nSadTime;
nSadTime = g_wday*100 + g_hour;
if( tempnSadTme != nSadTime)//函沁促搁
{
t_packet p;
p.h.header.type = CMD_SADONIX_COUNT_UPDATE;
p.h.header.size = sizeof(t_SadonixCountUpdate);
p.u.SadonixCountUpdate.nSadTime = nSadTime;
QueuePacket( connections, DB_DEMON, &p, 1 );
}
}
}
// 扒 扁贱俊 措秦 矫傈矫埃捞 瘤唱搁 角青矫挪促.
void CheckSkillTimeElapsed( void )
{ //< CSD-HK-030829
static DWORD time;
RefreshSkillMapTable();
ReduceTame();
if (g_curr_time != time)
{
time = g_curr_time;
}
else
{
return;
}
CheckWeatherSystem();
WeatherControl.CheckDayLight();
for (int i = DRAGON_CONNECTIONS_START; i < DRAGON_MAX_CONNECTIONS ; ++i)
{
if (connections[i].dwAgentConnectionIndex && connections[i].state >= CONNECT_JOIN)
{
CHARLIST* pTarget = &connections[i].chrlst;
if (pTarget->GetServerID() != i)//020530 lsw
{
MyLog(LOG_FATAL,"Wrong ServerID User Have [%d] But [%d]", pTarget->GetServerID(), i);
pTarget->SetServerID(i);
}
CrackMgr.AutoCheckAccelator(pTarget);
WeatherControl.AutoSetDayLight(pTarget);
if (pTarget->bAlive == ALIVE_)
{
SkillMgr.AutoRecoverHp(pTarget);
SkillMgr.AutoRecoverMp(pTarget);
SkillMgr.AutoChangeHungry(pTarget);
SkillMgr.AutoRecoverCp(pTarget);
SkillMgr.AutoRefreshRareMakeCount(pTarget);
SkillMgr.AutoSetCanView(pTarget); //蜡飞 , 气藕 , 付过飘乏 殿阑 杭 荐 乐绰瘤 眉农
RareEM.AutoCheckDynamicRare(pTarget->DynamicRare);
if (pTarget->cur_skillno)
{
if (pTarget->exetime_skill < g_curr_time)
{
SkillMapper(i, pTarget->cur_skillno, pTarget->cur_skillx, pTarget->cur_skilly, pTarget->cur_skilltargettype, pTarget->cur_skilltarget_id, pTarget->cur_skillPOS);
pTarget->cur_skillno = 0;
}
}
}
}
}
// 阁胶磐 磊悼 眉仿 雀汗
for (int j = NPC_LIST_START; j < MAX_NPC_LIST; ++j)
{
CHARLIST* ch = CheckNpcId(j);
if (ch == NULL) continue;
if (ch->bAlive == ALIVE_ && ch->IsLifeUp() && global_time >= ch->dwHpRecoverTime)
{
ch->dwHpRecoverTime = global_time + DEFAULT_RECOVER_HP_TIME;
const int nLife = ch->GetLifeUp();
const int nReal = ch->IncLife(nLife);
if (nReal > 0)
{ // 眉仿 雀汗贸烦 荤侩
t_packet packet;
packet.h.header.type = CMD_MAGIC_RESULT_H;
packet.h.header.size = sizeof(t_server_magic_result_h);
packet.u.magic.server_magic_result_h.nMagic = LIFE_UP;
packet.u.magic.server_magic_result_h.idTarget = j + 10000;
packet.u.magic.server_magic_result_h.nLife = nReal;
packet.u.magic.server_magic_result_h.nState = ch->GetState();
packet.u.magic.server_magic_result_h.nResult = HIT_AND_NOTDEAD;
::CastNPC2Other(j, &packet);
}
}
}
UpdateSadonixCount();
} //> CSD-HK-030829
//瘤况具 且 巴 鞍篮 窃荐 涝聪促.
void RecvSkillCursorView(const int cn, t_client_skill_cursor_view *p)
{
t_packet packet;
packet.h.header.type = CMD_SKILL_CURSOR_VIEW;
{
packet.u.client_skill_cursor_view.skillno = p->skillno;
packet.u.client_skill_cursor_view.x = p->x;
packet.u.client_skill_cursor_view.y = p->y;
}
packet.h.header.size = sizeof( t_client_skill_cursor_view );
// QueuePacket( connection, cn, &packet );
CastMe2Other( cn, &packet );
}
// 扁贱 搬苞甫 促弗捞俊霸 舅赴促.
// 漂洒 档迪扁贱俊 角菩窍搁 鞘洒 舅妨具 窍瘤... 鞠....
// cn : 扁贱阑 敬荤恩.
// target_id : 扁贱阑 寸茄 荤恩..
void SendSkillResultToOther(const int cn, const int skillno, const int target_id, const int result )
{
t_packet p;
p.h.header.type = CMD_SKILL_RESULT_TOOTHER;
p.u.server_skill_result_toother.id = cn; // 扁贱阑 敬荤恩..
p.u.server_skill_result_toother.skillno = skillno;
p.u.server_skill_result_toother.result = result;
p.h.header.size = sizeof( t_server_skill_result_fail ); //
QueuePacket( connections, target_id, &p, 1);
}
void SendSkillResult(const int cn, const int skillno, const int target_id, const int x, const int y, const int result )
{
t_packet p;
p.h.header.type = CMD_SKILL_RESULT;
p.u.server_skill_result.skillno = skillno;
p.u.server_skill_result.x = x;
p.u.server_skill_result.y = y;
p.u.server_skill_result.result = result;
p.h.header.size = sizeof( t_server_skill_result );
QueuePacket( connections, cn, &p, 1);
}
void SendViewTypeChange(const int cn, int viewtype )
{
t_packet p;
p.h.header.type = CMD_VIEWTYPE_CHANGE;
p.h.header.size = sizeof( t_viewtype_change );
p.u.viewtype_change.server_id = cn;
p.u.viewtype_change.viewtype = viewtype;
if( cn < 10000 ) //PC牢 版快父 焊晨
{
QueuePacket( connections, cn, &p, 1);
CastMe2Other( cn, &p );
}
else
{
CastNPC2Other( cn-10000, &p);
}
}
int skill_Detect_Ghost ( const int cn, const int skillno, const int x, const int y, const int targettype, const int target_id )
{
CHARLIST *ch = CheckServerId(cn);//020531 lsw
if( !ch ) return false; // 020620 YGI
const int iHitrate = ReturnSkillProbablity( cn, skillno, x, y, targettype, target_id );
const int r = rand()%100;
const int iTime = (SkillTbl[skillno].Produce_Fix*iHitrate)/1000000;//杭 荐 乐绰 檬 窜困
if(SkillMgr.CanViewGhost(ch)){goto FAIL_; }
if( r > iHitrate ) { goto FAIL_; }
if(!iTime) { goto FAIL_; }
SkillMgr.SetCanViewGhost(ch,iTime);
SendSkillResult( cn, skillno, target_id, x, y, iTime );
return 1;
FAIL_:
SendSkillResultFail(cn, skillno);
return 0;
}
int skill_Poisoning (const int cn, const int skillno, const int x, const int y, const int targettype, const int target_id )
{
SendSkillResult( cn, skillno, target_id, x, y, -999 );
return 1;
}
int skill_Detect_Poison (const int cn, const int skillno, const int x, const int y, const int targettype, const int target_id )
{
SendSkillResult( cn, skillno, target_id, x, y, -999 );
return 1;
}
int skill_Find_Traps (const int cn, const int skillno, const int x, const int y, const int targettype, const int target_id )
{
CHARLIST *ch = GetCharListPtr(cn);
if(!ch) return 0;
if( ch->bCanViewTrap ){ return 1;}
const int iHitrate = ReturnSkillProbablity( cn, skillno, x, y, targettype, target_id );
const int r = rand()%100;
if( r > iHitrate ) { SendSkillResultFail(cn, skillno); return 0; }
const int lv = ch->skillexp[ SkillTbl[skillno].MotherSkillType].skillexp / 10000;
int iTime = 30 + (lv*3);// 扁夯 30 檬 + 1 寸 3
const int MAX = 300;
if( iTime > MAX ) {iTime = MAX;}
SkillMgr.SetCanViewTrap(ch,iTime);//020510 lsw
SendSkillResult( cn, skillno, target_id, x, y, iTime );
return 1;
}
int skill_GhostResurrection(const int cn, const int skillno, const int x, const int y, const int targettype, const int target_id )
{
const int r = rand()%100;;
int hitrate;
LPCHARLIST Caster= CheckServerId(cn);
LPCHARLIST Target= CheckServerId(target_id);
if( ! Caster ) {goto FAIL_;}
if( ! Target ) {goto FAIL_;}
if(!SkillMgr.CanViewGhost(Caster)) { goto FAIL_; }//蜡飞阑 杭 荐 绝促//020701 lsw
if( Target->viewtype != VIEWTYPE_GHOST_ ) { goto FAIL_; }
hitrate = ReturnSkillProbablity( cn, skillno, x, y, targettype, target_id );
if( r >= hitrate ) {goto FAIL_; }
// 捞扁贱篮 努贰胶啊 己流磊父 荤侩且荐 乐促.
switch(Caster->Class)
{
case WARRIOR :
case THIEF :
case ARCHER :
case WIZARD : goto FAIL_;
case PRIEST : break;
}
//< soto-030326 吝赋瘤开捞 酒匆锭绰...促弗 惫啊 荤恩阑 混副荐啊 绝促. 1.02滚怜
if(!IsNeutralZone(MapNumber))
{
if(Caster->name_status.nation != Target->name_status.nation)
goto FAIL_;
}
//> soto-030326
// 扁贱捞 甸绢艾栏唱 穿啊 刚历 混啡阑 锭...
// if(CON_NORMAL == Target->GetState() ) {goto FAIL_;}
if( CheckEventAttack()) {goto FAIL_;}//020205 lsw
if( CanLocalWarAttack(Caster,Target) ) {goto FAIL_;}//020205 lsw
SkillMgr.CharacterToAlive(Target);//荤恩 混府扁
addEXP( Caster, Target, HIT_GHOSTRESURRECTION, Target->HpMax / 10 );
SendSkillResult( cn, skillno, target_id, x, y, target_id );
return 1;
FAIL_:
SendSkillResultFail(cn, skillno);
return 0;
}
//01214 lsw
int skill_Remove_Traps (const int cn, const int skillno, const int x, const int y, const int targettype, const int target_id )
{
CItem_Etc *t;
int UserSkillLevel = 0;
const int ret = ReturnSkillProbablity( cn, skillno, x, y, targettype, target_id );
if( ret == 0 ) goto FAIL_;
t =(CItem_Etc *)ItemUnit( ItemList[ target_id].item_no);
if(!t){goto FAIL_;}
if(t->GetItemKind() != IK_TRAP){goto FAIL_;}
UserSkillLevel = connections[ cn].chrlst.skillexp[ SkillTbl[skillno].MotherSkillType].skillexp / 10000;
if( t->Repair_max > UserSkillLevel ) {goto FAIL_;}
if( ItemList[ target_id].attr[ IATTR_ATTR] & IA2_TRAPED1 )
{
ItemList[ target_id].attr[ IATTR_ATTR] &= ( ~(IA2_NOTMOVE) );
ItemList[ target_id].attr[ IATTR_ATTR] &= ( ~(IA2_TRAPED1) );
//1024 zhh
ItemList[ target_id].attr[IATTR_DURATION] = 10;
SetArea( CHANGE_IA2_ATTR_ITEM_AREA, target_id );
//1020 zhh
RemoveItemList(target_id);
AddItemList( ItemList[target_id].item_no , ItemList[target_id].attr , 0, ItemList[target_id].x, ItemList[target_id].y, 0, 0);
// AddItemList( c[cn].chrlst.handheld.item_no, c[cn].chrlst.handheld.attr, 0, pi->x, pi->y, 0, 0 );
SendSkillResult( cn, skillno, target_id, x, y, 1 );
return 1;
}
FAIL_ :
SendSkillResultFail(cn, skillno); return 0;
}
//011215 lsw
int skill_Entrapment (const int cn, const int skillno, const int x, const int y, const int target
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -