Exemplo n.º 1
0
        protected virtual void NetFuncBuyNpcItem(short itemIndex, short amount)
        {
            if (currentNpcDialog == null)
            {
                return;
            }
            NpcSellItem[] sellItems = currentNpcDialog.sellItems;
            if (sellItems == null || itemIndex >= sellItems.Length)
            {
                return;
            }
            NpcSellItem sellItem = sellItems[itemIndex];

            if (!gameplayRule.CurrenciesEnoughToBuyItem(this, sellItem, amount))
            {
                gameManager.SendServerGameMessage(ConnectionId, GameMessage.Type.NotEnoughGold);
                return;
            }
            int dataId = sellItem.item.DataId;

            if (this.IncreasingItemsWillOverwhelming(dataId, amount))
            {
                gameManager.SendServerGameMessage(ConnectionId, GameMessage.Type.CannotCarryAnymore);
                return;
            }
            gameplayRule.DecreaseCurrenciesWhenBuyItem(this, sellItem, amount);
            this.IncreaseItems(CharacterItem.Create(dataId, 1, amount));
        }
 public override void DecreaseCurrenciesWhenBuyItem(IPlayerCharacterData character, NpcSellItem sellItem, short amount)
 {
     character.Gold -= sellItem.sellPrice * amount;
 }
Exemplo n.º 3
0
 public abstract void DecreaseCurrenciesWhenBuyItem(IPlayerCharacterData character, NpcSellItem sellItem, short amount);
 public override bool CurrenciesEnoughToBuyItem(IPlayerCharacterData character, NpcSellItem sellItem, short amount)
 {
     return(character.Gold >= sellItem.sellPrice * amount);
 }
Exemplo n.º 5
0
 public abstract bool CurrenciesEnoughToBuyItem(IPlayerCharacterData character, NpcSellItem sellItem, short amount);