private void QuestDropItem(AbstractGame game, int copyId, int npcId, bool playResult) { if (m_player.GetItemCount(m_info.Para1) < m_info.Para2) { List <ItemInfo> infos = null; int golds = 0, moneys = 0, gifttokens = 0; if (game is PVEGame) { DropInventory.PvEQuestsDrop(npcId, ref infos); } if (game is PVPGame) { DropInventory.PvPQuestsDrop(game.RoomType, playResult, ref infos); } if (infos != null) { foreach (ItemInfo info in infos) { ItemInfo.FindSpecialItemInfo(info, ref golds, ref moneys, ref gifttokens); if (info != null) { m_player.TempBag.AddTemplate(info, info.Count); } } m_player.AddGold(golds); m_player.AddGiftToken(gifttokens); m_player.AddMoney(moneys); LogMgr.LogMoneyAdd(LogMoneyType.Award, LogMoneyType.Award_Drop, m_player.PlayerCharacter.ID, moneys, m_player.PlayerCharacter.Money, 0, 0, 0, "", "", "");//添加日志 } } }
private void QuestDropItem(AbstractGame game, int copyId, int npcId, bool playResult) { if (this.m_player.GetItemCount(this.m_info.Para1) < this.m_info.Para2) { List <ItemInfo> list = null; int value = 0; int num = 0; int value2 = 0; int value3 = 0; if (game is PVEGame) { DropInventory.PvEQuestsDrop(npcId, ref list); } if (game is PVPGame) { DropInventory.PvPQuestsDrop(game.RoomType, playResult, ref list); } if (list != null) { foreach (ItemInfo current in list) { ItemInfo.FindSpecialItemInfo(current, ref value, ref num, ref value2, ref value3); if (current != null) { this.m_player.TempBag.AddTemplate(current, current.Count); } } this.m_player.AddGold(value); this.m_player.AddGiftToken(value2); this.m_player.AddMoney(num); this.m_player.AddMedal(value3); LogMgr.LogMoneyAdd(LogMoneyType.Award, LogMoneyType.Award_Drop, this.m_player.PlayerCharacter.ID, num, this.m_player.PlayerCharacter.Money, 0, 0, 0, 0, "", "", ""); } } }
public void TestDropPerformance() { List <ItemInfo> tempItem = null; for (int i = 0; i < 100000; i++) { DropInventory.PvEQuestsDrop(1, ref tempItem); if (tempItem != null) { Console.WriteLine(tempItem.First().Template.Name); } DropInventory.NPCDrop(3, ref tempItem); DropInventory.CopyDrop(1071, 1, ref tempItem); } }
private void PveQuestDropItem(AbstractGame game, int npcId, bool playResult) { int haveItemCount = this.m_player.GetItemCount(this.m_info.Para1) + this.m_player.TempBag.GetItemCount(this.m_info.Para1); if (haveItemCount < this.m_info.Para2) { List <ItemInfo> infos = null; int golds = 0; int moneys = 0; int gifttokens = 0; switch (game.GameType) { case eGameType.Exploration: case eGameType.Boss: case eGameType.Treasure: DropInventory.PvEQuestsDrop(npcId, this.m_info.Para1, ref infos); break; } if (infos != null) { foreach (ItemInfo info in infos) { ItemInfo tempItem = ItemInfo.FindSpecialItemInfo(info, ref golds, ref moneys, ref gifttokens); if (haveItemCount + info.Count > this.m_info.Para2) { info.Count = this.m_info.Para2 - haveItemCount; if (info.Count <= 0) { continue; } } if (tempItem != null && info.Count > 0) { this.m_player.TempBag.AddTemplate(tempItem, info.Count); } } this.m_player.AddGold(golds); this.m_player.AddGiftToken(gifttokens); this.m_player.AddMoney(moneys, LogMoneyType.Award, LogMoneyType.Award_Drop); } } }