当前位置:首页>>魔兽单机>>正文
魔兽单机中的PVP从玩家身上掉落的代码
2013-07-05 17:23:20 作者:网络 来源: 浏览次数:0
摘要:玩家PVP随机从包里面掉落某个物品给胜利者

玩家PVP随机从包里面掉落某个物品给胜利者(自己先设置conf)貌似是M端的代码?不记得了

 if (sWorld.getPvpLoot(PLAYER_LOOT_ENABLE))
{
        if (looterPlr->getLevel() - getLevel() < sWorld.getPvpLoot(PLAYER_LOOT_LEVEL_DIFF))
        {
            uint32  gold = (uint32)( urand(50, 150) * 0.016f * pow( ((float)bones->loot.gold)/5.76f, 2.5f) * sWorld.getRate(RATE_DROP_MONEY) * sWorld.getPvpLoot(PLAYER_LOOT_MONEY) );
            if (GetMoney() >= gold)
            {
                SetMoney(GetMoney()-gold);
                bones->loot.gold = gold;
                ChatHandler(this).PSendSysMessage( LANG_PVP_LOSS_MONEY_MESSAGE, UTF8Cn::GetNameLink(looterPlr->GetName()).c_str(), gold/10000 );
                ChatHandler(looterPlr).PSendSysMessage( LANG_PVP_WIN_MONEY_MESSAGE, UTF8Cn::GetNameLink(this->GetName()).c_str(), gold/10000 );
            }
            else
                bones->loot.gold = 0;
 
            if ( sWorld.getPvpLoot(PLAYER_LOOT_ITEM_ON_OFF))
            {
                srand((unsigned)time(0));
 
uint32 BAGID=(rand()% 4) + 19;  //想主的那个背包掉,就随机5 当是5时值定BAGID=255就行了,主背包最右边的是255,其它是19-22 
Bag *pBag;
pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, BAGID );
Item * item = GetItemByPos(BAGID,rand()%(pBag->GetBagSize()));//取随机包里的随机位置
 
 
if(item && pBag){
uint32  itemid = item->GetEntry();
ItemPrototype const *pProto = objmgr.GetItemPrototype( itemid );
                if(pProto &&  itemid != Hearthstone && itemid != Itemteleport && pProto->Bonding ==0)
                {
                    DestroyItemCount(itemid,1,true);
                    LootStoreItem lootitem=LootStoreItem(itemid,100,0,0,1,1);
                    lootitem.needs_quest = 0;
                    bones->loot.items.push_back(LootItem(lootitem));
                    bones->loot.unlootedCount++;
 
                    std::string itemname;
itemname=pProto->Name1;
                    
                    ChatHandler(this).PSendSysMessage( LANG_PVP_LOSS_ITEM_MESSAGE, UTF8Cn::GetNameLink(looterPlr->GetName()).c_str(), UTF8Cn::GetItemLink(UTF8Cn::ConvertStr(itemid),itemname).c_str() );
                    ChatHandler(looterPlr).PSendSysMessage( LANG_PVP_WIN_ITEM_MESSAGE, UTF8Cn::GetNameLink(this->GetName()).c_str(), UTF8Cn::GetItemLink(UTF8Cn::ConvertStr(itemid),itemname).c_str() );
                }
 
}
 
 
            }
        }
        else    bones->loot.gold = 0;
    } 
 


相关报道:

[关闭] [返回顶部]


  返回首页 | 最新资讯 | 资源下载 | 魔兽图片 | 单机文档 | 技术攻略 | 玩家视频
备案号:蜀ICP备2024062380号-1
免责声明:本网站为热爱怀旧WOW的玩家们建立的魔兽世界资料网站,仅供交流和学习使用,非盈利和商用.如有侵权之处,请联系我们,我们会在24小时内确认删除侵权内容,谢谢合作。
Copyright © 2024 - 2024 WOWAII.COM Corporation, All Rights Reserved

机器人国度