[講解]掉寶糖,經驗加倍書不會重複銷耗的問題
看過許多問題,問說為什麼多使用一次加倍書,掉寶糖會什麼不會減少數量原因在於map執行端
請打開src\map\pc.c
看到下列函數
int pc_isUseitem(struct map_session_data *sd,int n)
{
struct item_data *item;
int nameid;
nullpo_retr(0, sd);
item = sd->inventory_data;
nameid = sd->status.inventory.nameid;
if( item == NULL )
return 0;
//Not consumable item
if( item->type != IT_HEALING && item->type != IT_USABLE )
return 0;
if( !item->script ) //if it has no script, you can't really consume it!
return 0;
switch( nameid )
{
case 605: // Anodyne
if( map_flag_gvg(sd->bl.m) )
return 0;
case 606:
if( pc_issit(sd) )
return 0;
break;
case 601: // Fly Wing
case 12212: // Giant Fly Wing
if( map.flag.noteleport || map_flag_gvg(sd->bl.m) )
{
clif_skill_teleportmessage(sd,0);
return 0;
}
case 602: // ButterFly Wing
case 14527: // Dungeon Teleport Scroll
case 14581: // Dungeon Teleport Scroll
case 14582: // Yellow Butterfly Wing
case 14583: // Green Butterfly Wing
case 14584: // Red Butterfly Wing
case 14585: // Blue Butterfly Wing
case 14591: // Siege Teleport Scroll
if( sd->duel_group && !battle_config.duel_allow_teleport )
{
clif_displaymessage(sd->fd, "Duel: Can't use this item in duel.");
return 0;
}
if( nameid != 601 && nameid != 12212 && map.flag.noreturn )
return 0;
break;
case 604: // Dead Branch
case 12024: // Red Pouch
case 12103: // Bloody Branch
case 12109: // Poring Box
if( map.flag.nobranch || map_flag_gvg(sd->bl.m) )
return 0;
break;
case 12210: // Bubble Gum
case 12264: // Comp Bubble Gum
if( sd->sc.data )
return 0;
break;
case 12208: // Battle Manual
case 12263: // Comp Battle Manual
case 12312: // Thick Battle Manual
case 12705: // Noble Nameplate
case 14532: // Battle_Manual25
case 14533: // Battle_Manual100
case 14545: // Battle_Manual300
if( sd->sc.data )
return 0;
break;
case 14592: // JOB_Battle_Manual
if( sd->sc.data )
return 0;
break;
// Mercenary Items
case 12184: // Mercenary's Red Potion
case 12185: // Mercenary's Blue Potion
case 12241: // Mercenary's Concentration Potion
case 12242: // Mercenary's Awakening Potion
case 12243: // Mercenary's Berserk Potion
if( sd->md == NULL || sd->md->db == NULL )
return 0;
if( sd->md->sc.data )
return 0;
if( nameid == 12242 && sd->md->db->lv < 40 )
return 0;
if( nameid == 12243 && sd->md->db->lv < 80 )
return 0;
break;
}
if( nameid >= 12153 && nameid <= 12182 && sd->md != NULL )
return 0; // Mercenary Scrolls
//added item_noequip.txt items check by Maya&
if (
(map.flag.pvp && item->flag.no_equip&1) || // PVP
(map_flag_gvg(sd->bl.m) && item->flag.no_equip&2) || // GVG
(map.flag.restricted && item->flag.no_equip&map.zone) // Zone restriction
)
return 0;
//Gender check
if(item->sex != 2 && sd->status.sex != item->sex)
return 0;
//Required level check
if(item->elv && sd->status.base_level < (unsigned int)item->elv)
return 0;
//Not equipable by class.
if (!(
(1<<(sd->class_&MAPID_BASEMASK)) &
(item->class_base)
))
return 0;
//Not usable by upper class.
if(!(
(1<<(sd->class_&JOBL_UPPER?1:(sd->class_&JOBL_BABY?2:0))) &
item->class_upper
))
return 0;
//Dead Branch & Bloody Branch & Porings Box
if((log_config.branch > 0) && (nameid == 604 || nameid == 12103 || nameid == 12109))
log_branch(sd);
return 1;
}
switch( nameid )
nameid就是物品ID
至於為什麼不能重複使用掉寶糖的原因在這
case 12264: // Comp Bubble Gum
if( sd->sc.data )//檢查玩家狀態,是否已經使用
return 0;
頁:
[1]