吾爱尚玩资源基地
标题:
模拟器头衔等级差距掉落系统代码
[打印本页]
作者:
admin
时间:
2016-4-18 22:37
标题:
模拟器头衔等级差距掉落系统代码
Index: Player.cpp===================================================================
--- Player.cpp (revision 431)
+++ Player.cpp (working copy)
@@ -19584,6 +19584,23 @@
}
//--------------------------清理个人副本系统-------------------------//
+//----------------头衔等级差距掉落系统----------------------//
+uint32 Player::GetTitleNumber()//头衔等级差距掉落系统
+{
+ uint32 titles = GetUInt32Value(PLAYER_CHOSEN_TITLE);
+ uint32 titles_value;
+ if (titles == 0)
+ titles_value = 0;
+ else if (titles < 15)
+ titles_value = titles;
+ else if (titles < 29)
+ titles_value = titles - 14;
+ else
+ titles_value = 0;
+ return titles_value;
+}
+//----------------头衔等级差距掉落系统----------------------//
+
void Player::AutoUnequipOffhandIfNeed()
{
Item *offItem = GetItemByPos( INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND );
Index: Player.h
===================================================================
--- Player.h (revision 431)
+++ Player.h (working copy)
@@ -1118,6 +1118,8 @@
void PSendWorldCnCenterMessage(int32 entry, ...);//全世界信息,屏幕中间entry对应mangos_string //PvP 杀人系统
//--------------------------清理个人副本系统-------------------------//
void CleanSiglePlayerIntance(Player* player);//清理个人副本系统
+//----------------头衔等级差距掉落系统----------------------//
+ uint32 GetTitleNumber();//头衔等级差距掉落系统
//-----------------------------个性化结束-------------------------
void GiveXP(uint32 xp, Unit* victim);
void GiveLevel(uint32 level);
Index: Unit.cpp
===================================================================
--- Unit.cpp (revision 431)
+++ Unit.cpp (working copy)
@@ -598,7 +598,27 @@
uint32 killeritemid = objmgr.PlayerLootKillerItemid(entry);
if (itemID==0)
break;
- ItemPosCountVec dest;
+
+ if (sConfig.GetIntDefault("PvP.Title.On.Off", 0) == 1 && NEWPASSSYSTEM==sConfig.GetIntDefault("NewPassSystem", 0))//头衔掉落开始
+ {
+ uint32 playertitle = player->GetTitleNumber();
+ uint32 pVictimtitle = ((Player*)pVictim)->GetTitleNumber();
+ int32 titlediff1 = playertitle - pVictimtitle;
+ int32 titlediff2 = pVictimtitle - playertitle;
+ if ( titlediff1 > sConfig.GetIntDefault("PlayerLoot.Title.Diff", 2) || titlediff2 > sConfig.GetIntDefault("PlayerLoot.Title.Diff", 2) )
+ {
+ player->PSendSysCnMessage(15031,titlediff1);//屏幕左下角信息
+ ((Player*)pVictim)->PSendSysCnMessage(15031,titlediff1);//屏幕左下角信息
+ break;
+ }
+ else if (titlediff1 < 0)
+ {
+ uint32 itemCountAdd = titlediff2 * sConfig.GetIntDefault("PlayerLoot.Title.Additem", 2);
+ itemCount += itemCountAdd;
+ }
+ }////头衔掉落结束
+
+ ItemPosCountVec dest;
//player->GetSession()->SendAreaTriggerMessage("item id is %u,count is %u, chance is %u ",itemID,itemCount,chance);
uint8 msg = player->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, itemID, itemCount);
if( msg != EQUIP_ERR_OK )
@@ -608,7 +628,7 @@
}
else
{
- if (((Player*)pVictim)->HasItemCount(itemID, 1))
+ if (((Player*)pVictim)->HasItemCount(itemID, itemCount))
{
Item* item_1 = player->StoreNewItem( dest, itemID, true, Item::GenerateItemRandomPropertyId(itemID));
//if (chance ==0)break;
欢迎光临 吾爱尚玩资源基地 (http://bbs.523play.com/)
Powered by Discuz! X3.4