📄 skill_lsw.cpp
字号:
}
else
{
iItemtakeExp = Rareprobability[ItemLevel].exp_rare_suc[0];
}
}break;
default:
{
if( iItemUpgradeType< 0 || iItemUpgradeType >3) //捞芭 绢痘霸 窍聪.. ぱぱ;; 器记 澜侥 剧檬父 坷弗促
{
return 0;//捞繁幅狼 酒捞袍篮 己傍伏阑 林瘤 臼绰促
}
else
{
iItemtakeExp = Rareprobability[ItemLevel].exp_rare_suc[iItemUpgradeType];
}
}break;
}
if(iTryRare && (iSuccessRate < 0) )
{
ch->skillexp[iMotherSkillNo].rare = 0; //己傍伏捞 0 捞窍匙.. 0栏肺 悸泼
return 0;
}
if(iSuccessRate >1000) {iSuccessRate=1000;}
iMaxExp = Rareprobability[MySkillLevel-ItemLevel].max_suc;
if( iTryRare )//饭绢 父甸扁 矫档葛靛
{
LPSKILLEXP2 skillexp2;
skillexp2 = (t_skillexp2*)&ch->skillexp[iMotherSkillNo-14];
//罚待 矫俊 0捞 唱坷搁 逞绢啊霸阐 茄促
if(!iSuccess){return 0;}
if(!TryRareItemAbleDay(cn,MySkillLevel,skillexp2))
{
SkillMgr.SendSkillExp(iMotherSkillNo-14, ch->skillexp[iMotherSkillNo-14], cn);
return 0;
}
ch->skillexp[iMotherSkillNo].rare =0;
SkillMgr.SendSkillExp(iMotherSkillNo-14, ch->skillexp[iMotherSkillNo-14], cn);
if(rand()%(1001-iSuccessRate))//角菩 且锭 甸绢啊绰 风凭 !rand 啊 酒丛
{
RareType = 0;
SkillMgr.SendSkillExp(iMotherSkillNo, ch->skillexp[iMotherSkillNo], cn);//己傍伏捞 何练
return 0;//父甸扁 角菩
}
for(int i = 0; i < 8 ;i++)
{
TotalPercent += RareGroup[iTryRare/10][iRareGruop].rareset[i].rare_rate;
}
if(iTryRare && !TotalPercent)
{ //己傍伏捞 何练 弊缝 己傍伏 葛磊恩
return 0;
}//犬伏 葛磊扼辑 绝促.
NowPercent = rand()%TotalPercent;
int index = 0;
for(; index < 8 ;index++)
{ tempPercent += RareGroup[iTryRare/10][iRareGruop].rareset[index].rare_rate;
if( NowPercent < tempPercent )
{break; }
}
RareType = RareGroup[iTryRare/10][iRareGruop].rareset[index].rare_num;//饭绢鸥涝 搬沥
if(RareType)
{
SkillMgr.SendSkillExp(iMotherSkillNo-14, ch->skillexp[iMotherSkillNo-14], cn);
}//饭绢己傍
}
else//饭绢 矫档 救窃
{
if( bMultiEXP) //捞芭 绢痘霸 窍聪.. ぱぱ;; 器记 澜侥 剧檬父 坷弗促
{
// iItemtakeExp *= iMakeCount; //肮荐甫 蚌窍扁 秦霖促
iItemtakeExp *= 2; //蚌窍扁2 肺 秦 霖促
}
if( ch->skillexp[iMotherSkillNo].rare +(iItemtakeExp)> iMaxExp)
{
//版氰摹狼 眠啊 绝澜
if( ch->skillexp[iMotherSkillNo].rare > iMaxExp )//钙胶 焊促 臭促-> 眠啊 绝促
{
//钙胶焊促 臭栏搁 别瘤 臼绰促.
}
else//钙胶客 鞍芭唱 撤促 弊烦 钙胶促
{
ch->skillexp[iMotherSkillNo].rare = iMaxExp;
}
}
else
{
ch->skillexp[iMotherSkillNo].rare += iItemtakeExp ;
}
}
SkillMgr.SendSkillExp(iMotherSkillNo, ch->skillexp[iMotherSkillNo], cn);
return RareType;
}
int DeleteMakeItemResource( LPCHARLIST ch ,int item_no)
{
int i,j,k;
CItem *rit;
ItemAttr *item;
rit = ItemUnit(item_no);
POS pos;
if( rit )
{
for(i = 0;i < 3; i++ )
for(j = 0;j < 3; j++ )
for(k = 0; k< 8; k++ )
{
item = &ch->inv[i][j][k];
if( item->item_no == item_no)
{
if( (rit->GetRbutton() == DIVIDE_ITEM))
{
if(item->attr[IATTR_DURATION] >0)
{
item->attr[IATTR_DURATION]--;
return 1;
}
else
{
SendItemEventLog( item, ch->GetServerID(), SN_NOT_USER, SILT_RESOURCE_BY_SKILL, 4 ); //YGI acer
DeleteItem( item );
SetItemPos( INV, i, j, k, &pos );
SendServerEachItem( &pos , item, ch->GetServerID());
}
}
else
{
SendItemEventLog( item, ch->GetServerID(), SN_NOT_USER, SILT_RESOURCE_BY_SKILL, 4 ); //YGI acer
DeleteItem( item );
SetItemPos( INV, i, j, k, &pos );
SendServerEachItem( &pos , item, ch->GetServerID());
return 1;
}
}
}
}
return 0;
}
int LoadItemFunction()
{
HSTMT hStmt = NULL;
RETCODE retCode;
SDWORD cbValue;
SQLAllocStmt(hDBC, &hStmt);
retCode = SQLExecDirect(hStmt, (UCHAR *)"Select * from item_function order by [no]", SQL_NTS);
if(retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
int i = 0;
retCode = SQLFetch(hStmt);
while( retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
if(i >= MAX_ITEM_FUNCTION) return 0;
retCode = SQLGetData(hStmt, 1, SQL_C_LONG, &ItemFunction[i].iNo, 0, &cbValue);
retCode = SQLGetData(hStmt, 2, SQL_C_CHAR, ItemFunction[i].Name, 40, &cbValue);
retCode = SQLGetData(hStmt, 3, SQL_C_CHAR, ItemFunction[i].NameAdd,40, &cbValue);
retCode = SQLGetData(hStmt, 4, SQL_C_CHAR, ItemFunction[i].Exp , 50, &cbValue);
retCode = SQLGetData(hStmt, 5, SQL_C_LONG, &ItemFunction[i].ExpMark, 0, &cbValue);
retCode = SQLGetData(hStmt, 6, SQL_C_LONG, &ItemFunction[i].iEffectNo, 0, &cbValue);
retCode = SQLGetData(hStmt, 7, SQL_C_LONG, &ItemFunction[i].iUpgradeAble, 0, &cbValue);
retCode = SQLGetData(hStmt, 8, SQL_C_LONG, &ItemFunction[i].iScrollNo, 0, &cbValue);
retCode = SQLGetData(hStmt, 9, SQL_C_LONG, &ItemFunction[i].iMakeRand[0], 0, &cbValue);
retCode = SQLGetData(hStmt, 10, SQL_C_LONG, &ItemFunction[i].iMakeRand[1], 0, &cbValue);
retCode = SQLGetData(hStmt, 11, SQL_C_LONG, &ItemFunction[i].iMakeRand[2], 0, &cbValue);
retCode = SQLGetData(hStmt, 12, SQL_C_LONG, &ItemFunction[i].iGrade[0], 0, &cbValue);
retCode = SQLGetData(hStmt, 13, SQL_C_LONG, &ItemFunction[i].iGrade[1], 0, &cbValue);
retCode = SQLGetData(hStmt, 14, SQL_C_LONG, &ItemFunction[i].iGrade[2], 0, &cbValue);
retCode = SQLGetData(hStmt, 15, SQL_C_LONG, &ItemFunction[i].iGrade[3], 0, &cbValue);
retCode = SQLGetData(hStmt, 16, SQL_C_LONG, &ItemFunction[i].iGrade[4], 0, &cbValue);
retCode = SQLGetData(hStmt, 17, SQL_C_LONG, &ItemFunction[i].iGrade[5], 0, &cbValue);
retCode = SQLGetData(hStmt, 18, SQL_C_LONG, &ItemFunction[i].iGrade[6], 0, &cbValue);
retCode = SQLGetData(hStmt, 19, SQL_C_LONG, &ItemFunction[i].iGrade[7], 0, &cbValue);
retCode = SQLGetData(hStmt, 20, SQL_C_LONG, &ItemFunction[i].iGrade[8], 0, &cbValue);
retCode = SQLGetData(hStmt, 21, SQL_C_LONG, &ItemFunction[i].iGrade[9], 0, &cbValue);
retCode = SQLGetData(hStmt, 22, SQL_C_LONG, &ItemFunction[i].iGrade[10], 0, &cbValue);
retCode = SQLGetData(hStmt, 23, SQL_C_LONG, &ItemFunction[i].iGrade[11], 0, &cbValue);
retCode = SQLGetData(hStmt, 24, SQL_C_LONG, &ItemFunction[i].iGrade[12], 0, &cbValue);
retCode = SQLGetData(hStmt, 25, SQL_C_LONG, &ItemFunction[i].iGrade[13], 0, &cbValue);
retCode = SQLGetData(hStmt, 26, SQL_C_LONG, &ItemFunction[i].iGrade[14], 0, &cbValue);
retCode = SQLGetData(hStmt, 27, SQL_C_LONG, &ItemFunction[i].iGrade[15], 0, &cbValue);
retCode = SQLGetData(hStmt, 28, SQL_C_LONG, &ItemFunction[i].iGrade[16], 0, &cbValue);
retCode = SQLGetData(hStmt, 29, SQL_C_LONG, &ItemFunction[i].iTime[0], 0, &cbValue);
retCode = SQLGetData(hStmt, 30, SQL_C_LONG, &ItemFunction[i].iTime[1], 0, &cbValue);
retCode = SQLGetData(hStmt, 31, SQL_C_LONG, &ItemFunction[i].iTime[2], 0, &cbValue);
retCode = SQLGetData(hStmt, 32, SQL_C_LONG, &ItemFunction[i].iTime[3], 0, &cbValue);
retCode = SQLGetData(hStmt, 33, SQL_C_LONG, &ItemFunction[i].iTime[4], 0, &cbValue);
retCode = SQLGetData(hStmt, 34, SQL_C_LONG, &ItemFunction[i].iTime[5], 0, &cbValue);
retCode = SQLGetData(hStmt, 35, SQL_C_LONG, &ItemFunction[i].iTime[6], 0, &cbValue);
retCode = SQLGetData(hStmt, 36, SQL_C_LONG, &ItemFunction[i].iTime[7], 0, &cbValue);
retCode = SQLGetData(hStmt, 37, SQL_C_LONG, &ItemFunction[i].iTime[8], 0, &cbValue);
retCode = SQLGetData(hStmt, 38, SQL_C_LONG, &ItemFunction[i].iTime[9], 0, &cbValue);
retCode = SQLGetData(hStmt, 39, SQL_C_LONG, &ItemFunction[i].iTime[10], 0, &cbValue);
retCode = SQLGetData(hStmt, 40, SQL_C_LONG, &ItemFunction[i].iTime[11], 0, &cbValue);
retCode = SQLGetData(hStmt, 41, SQL_C_LONG, &ItemFunction[i].iTime[12], 0, &cbValue);
retCode = SQLGetData(hStmt, 42, SQL_C_LONG, &ItemFunction[i].iTime[13], 0, &cbValue);
retCode = SQLGetData(hStmt, 43, SQL_C_LONG, &ItemFunction[i].iTime[14], 0, &cbValue);
retCode = SQLGetData(hStmt, 44, SQL_C_LONG, &ItemFunction[i].iTime[15], 0, &cbValue);
retCode = SQLGetData(hStmt, 45, SQL_C_LONG, &ItemFunction[i].iTime[16], 0, &cbValue);
retCode = SQLGetData(hStmt, 46, SQL_C_LONG, &ItemFunction[i].iBuffer1, 0, &cbValue);
retCode = SQLGetData(hStmt, 47, SQL_C_LONG, &ItemFunction[i].iBuffer2, 0, &cbValue);
i++;
retCode = SQLFetch(hStmt);
if(retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
}
else if( retCode == SQL_NO_DATA )
{
break;
}
else
{
SQLFreeStmt(hStmt, SQL_DROP);
return 0;
}
}
}
else
{
SQLFreeStmt(hStmt, SQL_DROP);
return 0;
}
SQLFreeStmt(hStmt, SQL_DROP); // 0308 YGI
return 1;
}
void Send_RareItemMakeLog( const int cn, const int itemno,
const int today_count, const int grade,
const int mutanttype1, const int mutanttype2,
const int mutanttype3, const int addeditem1,
const int addeditem1limit, const int addeditem2,
const int addeditem2limit, const int resultlimit,
const int resultnowdur, const int resultmaxdur,
const int why, const int why2,
const int resource1limit, const int resource2limit,
const int resource3limit, const int resource4limit,
const int resource5limit, const int resource6limit)
{
if( cn < DRAGON_CONNECTIONS_START || cn >= DRAGON_MAX_CONNECTIONS ) return;
if( connections[cn].chrlst.SprType == SPRITETYPE_NPC ) return;
t_packet p;
t_rare_item_make_log *tp;
p.h.header.type = CMD_RARE_ITEM_MAKE_LOG;
p.h.header.size = sizeof( t_rare_item_make_log );
tp = &p.u.rare_item_make_log;
memcpy( tp->maker, connections[cn].name, 20 );
tp->map = MapInfo[MapNumber].port;
tp->itemno = itemno;
tp->today_count = today_count;
tp->grade = grade;
tp->mutanttype1 = mutanttype1;
tp->mutanttype2 = mutanttype2;
tp->mutanttype3 = mutanttype3;
tp->addeditem1 = addeditem1;
tp->addeditem1limit = addeditem1limit;
tp->addeditem2 = addeditem2;
tp->addeditem2limit = addeditem2limit;
tp->resultlimit = resultlimit;
tp->resultnowdur = resultnowdur;
tp->resultmaxdur = resultmaxdur;
tp->why = why;
tp->why2 = why2;
tp->resource1limit = resource1limit;
tp->resource2limit = resource2limit;
tp->resource3limit = resource3limit;
tp->resource4limit = resource4limit;
tp->resource5limit = resource5limit;
tp->resource6limit = resource6limit;
QueuePacket( connections, DB_DEMON, &p, 1 );
return;
}
int LoadLearnItemConvetrer()
{
HSTMT hStmt = NULL;
RETCODE retCode;
SDWORD cbValue;
SQLAllocStmt(hDBC, &hStmt);
retCode = SQLExecDirect(hStmt, (UCHAR *)"Select * from LearnItemConvert", SQL_NTS);
if(retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
int i = 0;
retCode = SQLFetch(hStmt);
while( retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
if(i >= MAX_LEARN_ITEM_CONVERT) return 0;
retCode = SQLGetData(hStmt, 1, SQL_INTEGER , &LIC[i].iBeforeItemNo , 0, &cbValue);
retCode = SQLGetData(hStmt, 2, SQL_INTEGER , &LIC[i].iAfterItemNo , 0, &cbValue);
i++;
retCode = SQLFetch(hStmt);
if(retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
}
else if( retCode == SQL_NO_DATA )
{
break;
}
else
{
SQLFreeStmt(hStmt, SQL_DROP);
return 0;
}
}
}
else
{
SQLFreeStmt(hStmt, SQL_DROP);
return 0;
}
SQLFreeStmt(hStmt, SQL_DROP); // 0308 YGI
return 1;
}
bool LoadRareItemBag()
{
HSTMT hStmt = NULL;
RETCODE retCode;
SDWORD cbValue;
SQLAllocStmt(hDBC, &hStmt);
retCode = SQLExecDirect(hStmt, (UCHAR *)"Select * from RareItemBag order by [no]", SQL_NTS);
if(retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
int i = 1;
retCode = SQLFetch(hStmt);
while( retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
if(i >= MAX_RAREITEMBAG)
{
SQLFreeStmt(hStmt, SQL_DROP);
return false;
}
/*
typedef struct RareItemBag
{
int iNo;
int RareItemBagPercentTableNo;
int iGradeMin;
int iGradeMax;
int ItemNo[21];//0 锅篮 绝绰 蔼
}RareItemBag;
*/
int column = 0;
retCode = SQLGetData(hStmt, ++column, SQL_C_LONG, &RareItemBag[i].iNo, 0, &cbValue);
retCode = SQLGetData(hStmt, ++column, SQL_C_LONG, &RareItemBag[i].iRareItemBagPercentTableNo, 0, &cbValue);
retCode = SQLGetData(hStmt, ++column, SQL_C_LONG, &RareItemBag[i].iGradeMin, 0, &cbValue);
retCode = SQLGetData(hStmt, ++column, SQL_C_LONG, &RareItemBag[i].iGradeMax, 0, &cbValue);
int iTotal = 0;
for(int count= 1; count <21; count ++)
{
int iDummy = 0;
retCode = SQLGetData(hStmt, ++column, SQL_C_LONG, &iDummy, 0, &cbValue);
RareItemBag[i].ItemNo[count] = iDummy;
iTotal+=iDummy;
}
RareItemBag[i].ItemNo[0] = iTotal;
i++;
retCode = SQLFetch(hStmt);
if(retCode == SQL_SUCCESS || retCode == SQL_SUCCESS_WITH_INFO)
{
}
else if( retCode == SQL_NO_DATA )
{
break;
}
else
{
SQLFreeStmt(hStmt, SQL_DROP);
return false;
}
}
}
else
{
SQLFreeStmt(hStmt, SQL_DROP);
return false;
}
SQLFreeStmt(hStmt, SQL_DROP); // 0308 YGI
return true;
}
bool LoadItemControlPercent()
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -