关灯
开启左侧

魔兽世界sf单机版M端中比较老的关于掉落品质的控制系统

  [复制链接]
admin实名认证 发表于 2016-4-23 16:41:28 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题
 
此代码仅仅作为单机版程序代码的一些历史查询和研究使用。对于现在的服务端基本没有任何实际价值


Index: src/game/LootMgr.cpp

===================================================================

--- src/game/LootMgr.cpp (revision 4737)

+++ src/game/LootMgr.cpp (working copy)

@@ -246,6 +246,12 @@


LootStoreItem* operator() ( LootStoreItem& itm )
{
+ uint32 quality=0;
+
+ // Get loot quality
+ ItemPrototype const *itemProto = objmgr.GetItemPrototype(itm.itemid);
+ if (itemProto) quality = itemProto->Quality;
+
// Quest loot handled separately
if (itm.questChanceOrGroup > 0)
return NULL;
@@ -253,10 +259,35 @@

// Non-grouped loot
if (itm.questChanceOrGroup == 0)
{
- // reference non group loot ( itm.chanceOrRef < 0) handled separatly
- if ( itm.chanceOrRef > 0 && roll_chance_f(itm.chanceOrRef * sWorld.getRate(RATE_DROP_ITEMS)) )
- return &itm;
- return NULL;
+ // Checks to see the quality of the loot and applies loot modifiers based on the rarity.
+ switch (quality)
+ {
+ case QUALITY_POOR:
+ if ( itm.chanceOrRef > 0 && roll_chance_f(itm.chanceOrRef * sWorld.getRate(RATE_DROP_POOR)) )
+ return &itm;
+ break;
+ case QUALITY_COMMON:
+ if ( itm.chanceOrRef > 0 && roll_chance_f(itm.chanceOrRef * sWorld.getRate(RATE_DROP_COMMON)) )
+ return &itm;
+ break;
+ case QUALITY_UNCOMMON:
+ if ( itm.chanceOrRef > 0 && roll_chance_f(itm.chanceOrRef * sWorld.getRate(RATE_DROP_UNCOMMON)) )
+ return &itm;
+ break;
+ case QUALITY_RARE:
+ if ( itm.chanceOrRef > 0 && roll_chance_f (itm.chanceOrRef * sWorld.getRate(RATE_DROP_RARE)) )
+ return &itm;
+ break;
+ case QUALITY_EPIC:
+ if ( itm.chanceOrRef > 0 && roll_chance_f (itm.chanceOrRef * sWorld.getRate(RATE_DROP_EPIC)) )
+ return &itm;
+ break;
+ case QUALITY_LEGENDARY:
+ if ( itm.chanceOrRef > 0 && roll_chance_f (itm.chanceOrRef * sWorld.getRate(RATE_DROP_LEGEND)) )
+ return &itm;
+ break;
+ }
+ return NULL;
}

// Grouped loot
@@ -311,7 +342,7 @@

struct HasQuestChance
{
// explicit HasQuestChanceFor() : {}
- inline bool operator() ( LootStoreItem &itm ) { return roll_chance_i(itm.questChanceOrGroup); }
+ inline bool operator() ( LootStoreItem &itm ) { return roll_chance_i(itm.questChanceOrGroup) * sWorld.getRate(RATE_DROP_QUEST); }
};

void FillLoot(Loot* loot, uint32 loot_id, LootStore& store, Player* loot_owner, bool referenced)
Index: src/game/LootMgr.h

===================================================================

--- src/game/LootMgr.h (revision 4737)

+++ src/game/LootMgr.h (working copy)

@@ -50,6 +50,16 @@

NEED_BEFORE_GREED = 4
};

+enum LootTypes
+{
+ QUALITY_POOR = 0,
+ QUALITY_COMMON = 1,
+ QUALITY_UNCOMMON = 2,
+ QUALITY_RARE = 3,
+ QUALITY_EPIC = 4,
+ QUALITY_LEGENDARY = 5
+};
+
enum PermissionTypes
{
ALL_PERMISSION = 0,
Index: src/game/World.cpp

===================================================================

--- src/game/World.cpp (revision 4737)

+++ src/game/World.cpp (working copy)

@@ -328,6 +328,13 @@

rate_values[RATE_POWER_FOCUS] = sConfig.GetFloatDefault("Rate.Focus", 1);
rate_values[RATE_LOYALTY] = sConfig.GetFloatDefault("Rate.Loyalty", 1);
rate_values[RATE_DROP_ITEMS] = sConfig.GetFloatDefault("Rate.Drop.Items", 1);
+ rate_values[RATE_DROP_POOR] = sConfig.GetFloatDefault("Rate.Drop.Items.Quality.Poor", 1);
+ rate_values[RATE_DROP_COMMON] = sConfig.GetFloatDefault("Rate.Drop.Items.Quality.Common", 1);
+ rate_values[RATE_DROP_UNCOMMON] = sConfig.GetFloatDefault("Rate.Drop.Items.Quality.Uncommon", 1);
+ rate_values[RATE_DROP_RARE] = sConfig.GetFloatDefault("Rate.Drop.Items.Quality.Rare", 1);
+ rate_values[RATE_DROP_EPIC] = sConfig.GetFloatDefault("Rate.Drop.Items.Quality.Epic", 1);
+ rate_values[RATE_DROP_LEGEND] = sConfig.GetFloatDefault("Rate.Drop.Items.Quality.Legendary", 1);
+ rate_values[RATE_DROP_QUEST] = sConfig.GetFloatDefault("Rate.Drop.Items.Quest", 1);
rate_values[RATE_DROP_MONEY] = sConfig.GetFloatDefault("Rate.Drop.Money", 1);
rate_values[RATE_XP_KILL] = sConfig.GetFloatDefault("Rate.XP.Kill", 1);
rate_values[RATE_XP_QUEST] = sConfig.GetFloatDefault("Rate.XP.Quest", 1);
Index: src/game/World.h

===================================================================

--- src/game/World.h (revision 4737)

+++ src/game/World.h (working copy)

@@ -121,6 +121,13 @@

RATE_POWER_RAGE_LOSS,
RATE_POWER_FOCUS,
RATE_DROP_ITEMS,
+ RATE_DROP_POOR,
+ RATE_DROP_COMMON,
+ RATE_DROP_UNCOMMON,
+ RATE_DROP_RARE,
+ RATE_DROP_EPIC,
+ RATE_DROP_LEGEND,
+ RATE_DROP_QUEST,
RATE_DROP_MONEY,
RATE_XP_KILL,
RATE_XP_QUEST,
Index: src/mangosd/mangosd.conf.in

===================================================================

--- src/mangosd/mangosd.conf.in (revision 4737)

+++ src/mangosd/mangosd.conf.in (working copy)

@@ -311,6 +311,13 @@

# Drop rates
# Default: 1
Rate.Drop.Items = 1
+Rate.Drop.Items.Quality.Poor = 1
+Rate.Drop.Items.Quality.Common = 1
+Rate.Drop.Items.Quality.Uncommon = 1
+Rate.Drop.Items.Quality.Rare = 1
+Rate.Drop.Items.Quality.Epic = 1
+Rate.Drop.Items.Quality.Legendary = 1
+Rate.Drop.Items.Quest = 1
Rate.Drop.Money = 1

# XP rates
 

精彩评论1

倒序浏览
1314 发表于 2016-12-6 20:43:55 | 显示全部楼层
 
找了好久终于找到了!吾爱尚玩真棒!
 
VIP介绍
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 最佳新人

    注册账号后积极发帖的会员
  • 活跃会员

    经常参与各类话题的讨论,发帖内容较有主见
  • 热心会员

    经常帮助其他会员答疑
  • 推广达人

    积极宣传本站,为本站带来更多注册会员
  • 宣传达人

    积极宣传本站,为本站带来更多的用户访问量
  • 灌水之王

    经常在论坛发帖,且发帖量较大
  • 突出贡献

    长期对论坛的繁荣而不断努力,或多次提出建设性意见
  • 优秀版主

    活跃且尽责职守的版主
  • 荣誉管理

    曾经为论坛做出突出贡献目前已离职的版主
  • 论坛元老

    为论坛做出突出贡献的会员

0关注

5粉丝

3421帖子

排行榜
作者专栏

QQ交流群&&微信订阅号

QQ交流群

微信订阅号

吾爱尚玩资源基地永久域名:

Www.523Play.Com

在线管理员QQ:1589479632

邮箱:Email@523play.com

QQ交流群:558936238

Copyright   ©2015-2116  吾爱尚玩资源基地|523play.comPowered by©523Pplay.Com技术支持:吾爱尚玩资源基地