Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public override bool Process(CharacterEntity character, Dictionary <string, string> parameters)
        {
            if (!character.CanGameAction(Action.GameActionTypeEnum.EXCHANGE))
            {
                character.Dispatch(WorldMessage.INFORMATION_MESSAGE(InformationTypeEnum.ERROR, InformationEnum.ERROR_YOU_ARE_AWAY));
                return(false);
            }

            var taxe = character.Bank.Items.GroupBy(item => item.TemplateId).Count();

            if (character.Inventory.Kamas < taxe)
            {
                if (character.Bank.Kamas < taxe)
                {
                    character.Dispatch(WorldMessage.INFORMATION_MESSAGE(InformationTypeEnum.ERROR, InformationEnum.ERROR_NOT_ENOUGH_KAMAS, taxe));
                    return(false);
                }

                character.Bank.SubKamas(taxe);
            }
            else
            {
                character.Inventory.SubKamas(taxe);
            }

            character.CachedBuffer = true;
            character.ExchangeStorage(character.Bank);
            character.Dispatch(WorldMessage.IM_INFO_MESSAGE(InformationEnum.INFO_KAMAS_LOST, taxe));
            character.CachedBuffer = false;

            return(true);
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="character"></param>
        public void StartUse(CharacterEntity character)
        {
            if (!character.CanGameAction(GameActionTypeEnum.EXCHANGE))
            {
                character.Dispatch(WorldMessage.INFORMATION_MESSAGE(InformationTypeEnum.ERROR, InformationEnum.ERROR_YOU_ARE_AWAY));
                return;
            }

            character.ExchangeStorage(m_storage);
        }