📄 op_inv.cpp
字号:
{
case EQUIP : {
release = true;
break;
}
case OTHER_CH : {
if( SourcePos.p3 >= 10000 ) break;
CHARLIST *target_ch = ::CheckServerId( SourcePos.p3 );
if( !target_ch ) return NOT;
::SendItemEventLog( pSourceItem, char_id, SourcePos.p3, SILT_GET_OTHER_CH_INVEN, 1 ); //YGI acer
// 020428 YGI acer
if( !::SendDeleteItem( pSourceItem, &other_pos, target_ch ) ) return NOT;
//soto-tai
target_ch->inv[other_pos.p1][other_pos.p2][other_pos.p3] = ::GenerateItem(IN_STEAL_RESULT);
::SendServerEachItem(&other_pos,&target_ch->inv[other_pos.p1][other_pos.p2][other_pos.p3],target_ch->GetServerID());
break;
}
case BANK :
{
::SendItemEventLog( pSourceItem, char_id, SN_NOT_USER, SILT_GET_BANK, 2 ); //YGI acer
break;
}
}
*pSourceItem= DestItem;
DestItem= tu ;
if( release )
{
ii->ReleaseItem( hero );
}
goto OK_;
}break;
//>soto-tai
case USE:
{
if( hero->IsDead() ){return 0;}
switch( ii->GetRbutton() )
{
case USE_ITEM:
case REMAIN_ITEM:
break;
default: {return 0;}break;
}
switch(tu.item_no)
{
case 3052:
{
if(hero->Gender == MALE)
{
::SendEatChcolate( hero->Name, pSourceItem->attr[IATTR_LIMIT], char_id );
}
}break;
case 3053:
{
if(hero->Gender == FEMALE )
{
::SendEatCandy( hero->Name, pSourceItem->attr[IATTR_LIMIT], hero->total_id );
}
}break;
case 3105:
{//< CSD-021003 : 傈捧胶懦 器牢飘 裙垫
if (!hero->IsLimit(1))
{
hero->IncCombatPoint(1);
}
}break;
default:
{
}break;
}
int no_delete = 0;// 瘤快瘤 臼阑 版快档 乐促.//1 捞搁 瘤快瘤父 臼澜 // 2 郴备档 别澜
if(SourcePos.type != GROUND && SourcePos.type != EQUIP)
{
int add_hp = 0;
const int iUseitemKind = ii->GetItemKind();
switch(iUseitemKind)
{
//<! BBD 040213 郴备档 乐绰 器记
case IK_POTION_BAG:
{
no_delete = 2;
add_hp = ii->EatItem( hero );
}break;
//> BBD 040213 郴备档 乐绰 器记
case IK_POTION_BOX:// 林赣聪甫 努腐沁促.
{
CPotionBox potion_box( hero );
add_hp = potion_box.UseItem();
no_delete = 1;
}break;
case IK_CANDLE:
case IK_GOOD_CANDLE:
{
no_delete = 2;
add_hp = ii->EatItem( hero );
if(ii->GetImunityCure3())//颇萍盔 康氢 鞘靛
{ // 措惑磊啊 颇萍盔牢 版快
for (int i = 0; i < MAX_PARTY_MEMBER; ++i)
{
if (hero->party[i].On)
{
//CHARLIST *Target = CheckServerId( hero->party[i].Server_id );
CHARLIST *Target = CheckServerName( hero->party[i].Name );
if(!Target){continue;}
::WeatherControl.SetChLight(Target,ii->GetImunityCure2(),5*60);
}
}
}
}break;
default:
{
add_hp = ii->EatItem( hero );
}break;
}//switch(iUseitemKind)
t_packet p;
p.h.header.type = CMD_SERVER_CHARACTER_CONDITION2; // 010618 YGI
p.h.header.size = sizeof( t_server_character_condition );
p.u.angra.server_character_condition.idTarget = WORD(char_id);
p.u.angra.server_character_condition.nLife = hero->Hp; // 010618 YGI
p.u.angra.server_character_condition.nState = hero->GetState();
QueuePacket( connections, char_id, &p, 1);
p.h.header.type = CMD_SERVER_CHARACTER_CONDITION;
p.u.angra.server_character_condition.nLife = add_hp; // 0224 YGI
::CastMe2Other( char_id, &p );
//020314 lsw
if(pSourceItem->attr[IATTR_RARE_MAIN] && ((RareMain*)&(pSourceItem->attr[IATTR_RARE_MAIN]))->IsDynamicRare)
{
const int iGrade= ((RareMain*)&(pSourceItem->attr[IATTR_RARE_MAIN]))->grade;
const int iPri = ((RareMain*)&(pSourceItem->attr[IATTR_RARE_MAIN]))->soksung1;
const int iSec = ((RareMain*)&(pSourceItem->attr[IATTR_RARE_MAIN]))->soksung2;
const int iThi = ((RareMain*)&(pSourceItem->attr[IATTR_RARE_MAIN]))->soksung3;
// 刚历 绝矩促. // YGI 020527
if( !no_delete )
{
::SendItemEventLog( pSourceItem, char_id, SN_NOT_USER, SILT_USE, 3 ); //YGI acer
::DeleteItem( pSourceItem ); // 荤侩茄扒 绢路电 绝绢柳促.
::SendServerEachItem(&SourcePos,pSourceItem,char_id);
no_delete = 1;
}
if( RareEM.ApplyDynamicRareEffect(hero,iPri,iGrade,1)
|| RareEM.ApplyDynamicRareEffect(hero,iSec,iGrade,2)
|| RareEM.ApplyDynamicRareEffect(hero,iThi,iGrade,3) )
{
iSendDyRareDisplayEffect = true;
}
if( (iUseitemKind == IK_GOOD_CANDLE || iUseitemKind == IK_CANDLE )// 剧檬搁
&& ii->GetImunityCure3() )//颇萍盔 康氢 鞘靛
{
// 措惑磊啊 颇萍盔牢 版快
for (int i = 0; i < MAX_PARTY_MEMBER; ++i)
{
if (hero->party[i].On)
{
//CHARLIST *Target = ::CheckServerId( hero->party[i].Server_id );
CHARLIST *Target = ::CheckServerName( hero->party[i].Name );
if(!Target){continue;}
RareEM.ApplyDynamicRareEffect(Target,iPri,iGrade,1);
RareEM.ApplyDynamicRareEffect(Target,iSec,iGrade,2);
RareEM.ApplyDynamicRareEffect(Target,iThi,iGrade,3);
}
}
}
}
switch(no_delete)
{
case 0:
{
::SendItemEventLog( pSourceItem, char_id, SN_NOT_USER, SILT_USE, 3 ); //YGI acer
::DeleteItem( pSourceItem ); // 荤侩茄扒 绢路电 绝绢柳促.
::SendServerEachItem(&SourcePos,pSourceItem,char_id);
}break;
case 1:
{
}break;
case 2:
{
::SendItemEventLog( pSourceItem, char_id, SN_NOT_USER, SILT_USE, 3 ); //YGI acer
const int iResult = ItemMgr.DecItemDur(*pSourceItem,MULTIPLE_USE_ONE_TIME_DEC_DUR); // 荤侩茄扒 郴备档甫 别绰促
::SendServerEachItem(&SourcePos,pSourceItem,char_id);
}break;
}
if(iSendDyRareDisplayEffect)//急琶扁瓷 酒捞袍俊 狼茄巴
{
::SendRareDisplayEffect(hero);
}
//酒捞袍阑 瘤快绊 瓤苞甫 惯戎 茄促//困尔 酒贰尔 促福促 老馆扁瓷 酒捞袍俊 狼茄巴 //捞 何盒篮 EatItemCommon俊 持瘤 富巴
if (RareEM.ApplyDynamicRareEffect(hero,ii->GetCureDisease1(),1,0))//咯扁辑 矫埃捞 悸泼 登绢 乐促
{
::SendRareDisplayEffect(hero,ii->GetCureDisease1());
return 0;
}//OK 啊 龋免 登瘤 臼阑 荐档 乐嚼聪促.(甘捞悼 酒捞袍狼 版快
goto OK_;
}
}break;
case GROUND:
{
if(pSourceItem)
{
pSourceItem->item_no= 0 ;
pSourceItem->attr[0]= 0 ;
pSourceItem->attr[1]= 0 ;
pSourceItem->attr[2]= 0 ;
pSourceItem->attr[3]= 0 ;
pSourceItem->attr[4]= 0 ;
pSourceItem->attr[5]= 0 ;
}
item_id = ::AddItemList( tu.item_no, tu.attr, 0, DestPos.p1, DestPos.p2, 0, 0) ;
if(item_id < 0) return 0 ;
else goto OK_;
}break ;
case CHARACTER: //0116 YGI
{
bool ret = false;
int p1=0, p2=0, p3=0 ;
CHARLIST *target_ch = ::CheckServerId( DestPos.p3 );
if( target_ch )
{
ret = ::SearchInv(target_ch->inv,p1,p2,p3);//021030 lsw
}
if(ret)
{ // 惑措规 某腐磐 牢亥配府俊 后镑捞 乐栏搁
target_ch->inv[p1][p2][p3]= tu ;
POS pos;
::SetItemPos( INV, p1,p2,p3, &pos );
::SendServerEachItem( &pos, &tu, DestPos.p3 ); // 001028 YGI
// SourcePos甫 瘤款促.
::SendItemEventLog( pSourceItem, char_id, DestPos.p3, SILT_PUT_OTHER_CH, 1 );
::SendItemEventLog( pSourceItem, DestPos.p3, char_id, SILT_GET_OTHER_CH, 1 );
::DeleteItem( pSourceItem );
goto OK_;
}
else // 促矫 登倒妨霖促.
{
::MoveEmptyInv( pSourceItem, &connections[char_id].chrlst );
}
break;
}
default:
{
return 0 ;
}break;
}
return 0;
OK_:
ResetAbility( hero );//020303 lsw
return 1;
}
/////////////////////////////////////////////////////////////////////////////////
// //
// //
// //
// Item捞 荤侩阑 贸府秦林绰 皋家靛甸 //
// //
// //
// //
// //
//////////////////////////////////////////////////////////////////////////////////
int CItem_Plant::use(int char_id, t_chr_status_info *cstatus, POS source, POS dest)
{
return OK ;
}
int CItem_Mineral::use(int char_id, t_chr_status_info *cstatus, POS source, POS dest)
{
return OK ;
}
int CItem_Herb::use(int char_id, t_chr_status_info *cstatus, POS source, POS dest)
{
return OK ;
}
int CItem_Cook::use(int char_id, t_chr_status_info *cstatus, POS source, POS dest)
{
return OK ;
}
int CItem_Potion::use(int char_id, t_chr_status_info *cstatus, POS source, POS dest)
{
//connections[char_id].chrlst.Hp += hp ;
//connections[char_id].chrlst.MoveP+= ap ;
//connections[char_id].chrlst.Mana += mp ;
// another effects?
return OK ;
}
/************************************************************************************/
//
//
// 裹侩 窃荐甸
//
//
/************************************************************************************/
// 酒捞袍 牢郸胶 舅酒郴绰 窃荐
void getItemIndex(int item_no, int &type, int &index)
{
type= item_no / 1000 ;
index= item_no % 1000 ;
}
void getItemIndex(int char_id, POS source, int &type, int &index)
{
//int type, index ;
switch(source.type) {
case HAND:
type= connections[char_id].chrlst.handheld.item_no / 1000 ;
index= connections[char_id].chrlst.handheld.item_no % 1000 ;
break ;
case INV:
type= connections[char_id].chrlst.inv[source.p1][source.p2][source.p3].item_no / 1000 ;
index= connections[char_id].chrlst.inv[source.p1][source.p2][source.p3].item_no % 1000 ;
break ;
case QUICK:
type= connections[char_id].chrlst.quick[source.p3].item_no / 1000 ;
index= connections[char_id].chrlst.quick[source.p3].item_no % 1000 ;
break ;
case EQUIP:
type= connections[char_id].chrlst.equip[source.p3].item_no / 1000 ;
index= connections[char_id].chrlst.equip[source.p3].item_no % 1000 ;
break ;
default:
type= 0 ;
index= 0 ;
break ;
}
}
//////////////////////////////////////////////////////////////////////////////
//
// 窃荐汲疙: 酒捞袍 盒府(俺荐啊 乐绰 酒捞袍老 版快; 捣, 揪狙殿狼)
// 泅犁 秦寸 某腐磐狼 牢亥配府郴俊辑父 啊瓷
//
// 颇扼固磐: char_id; 秦寸 某腐磐狼 id(index)
// source, dest; 酒捞袍狼 困摹沥焊
//
// 府畔蔼: 酒捞袍 盒府狼 己傍咯何
//
//////////////////////////////////////////////////////////////////////////////
int departItem(int char_id, POS source, POS dest, int dec_val)
{
ItemAttr tu, *source_ptr ;
int type, index ;
//getItemIndex(char_id, source, type, index) ;
getItemIndex(char_id, source, type, index) ;
// save source item info & position
printf("\n DEPART ITEM==> char_id:%d %d(%d %d %d) --> %d(%d %d %d) %d %d", char_id, source.type, source.p1, source.p2, source.p3,
dest.type, dest.p1, dest.p2, dest.p3, type, index) ;
switch(source.type) {
/*
case INV:
tu= connections[char_id].chrlst.inv[source.p1][source.p2][source.p3] ;
source_ptr= &connections[char_id].chrlst.inv[source.p1][source.p2][source.p3] ;
break ;
*/
case HAND:
tu= connections[char_id].chrlst.handheld ;
source_ptr= &connections[char_id].chrlst.handheld ;
break ;
default:
return NOT ;
}
// exchage the two items
switch(dest.type) {
case INV:
// set duration
source_ptr->attr[0]+= dec_val ;
connections[char_id].chrlst.inv[dest.p1][dest.p2][dest.p3]= tu ;
connections[char_id].chrlst.inv[dest.p1][dest.p2][dest.p3].attr[0]= -dec_val ;
return OK ;
break ;
/*
case HAND:
// 颊捞 厚绢乐绰啊甫 眉农秦具 窍绰啊????
// 积阿秦 焊磊~
if(source.type == EQUIP) { // Unequip
//getItemIndex(char_id, source, type, index) ;
Item_Ref.Item_Info[type][index]->unequip(char_id, cstatus, source, dest) ;
}
*source_ptr= connections[char_id].chrlst.handheld ;
connections[char_id].chrlst.handheld= tu ;
return OK ;
// pickup the item
break ;
*/
default:
return NOT ;
}
return OK ;
}
//////////////////////////////////////////////////////////////////////////////////
// //
// 汲疙: item 荤侩俊 蝶弗 某腐磐 荐摹 函拳 //
// //
// virtual 窃荐甸 //
// //
//////////////////////////////////////////////////////////////////////////////////
int CItem_Potion::UseItem( CHARLIST *ch)
{
ch->Hp += hp;
if( ch->Hp > ch->HpMax ) ch->Hp = ch->HpMax;
ch->Mana += mp;
if( ch->Mana > ch->ManaMax ) ch->Mana = ch->ManaMax;
// ch->TempMana = ch->Mana;//020214 lsw
ch->Hungry += ap; //hungry;
if( ch->Hungry > ch->HungryMax ) ch->Hungry = ch->HungryMax;
return 1;
}
int CItem_Herb::UseItem( CHARLIST *ch)
{
return 1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -