Ejemplo n.º 1
0
        private void OnReady(Trader trader, bool isready)
        {
            InventoryHandler.SendExchangeIsReadyMessage(Crafter.Character.Client,
                                                        trader, isready);
            InventoryHandler.SendExchangeIsReadyMessage(Receiver.Character.Client,
                                                        trader, isready);

            if (Receiver.Kamas > Receiver.Character.Inventory.Kamas)
            {
                InventoryHandler.SendExchangeCraftResultMessage(Clients, ExchangeCraftResultEnum.CRAFT_FAILED);
                return;
            }

            if (Crafter.ReadyToApply && Receiver.ReadyToApply)
            {
                ApplyAllRunes();

                if (Receiver.Kamas > 0)
                {
                    Crafter.Character.Inventory.AddKamas(-Receiver.Character.Inventory.SubKamas((int)Receiver.Kamas));
                    Receiver.SetKamas(0);
                }

                ContextRoleplayHandler.SendJobExperienceOtherPlayerUpdateMessage(Receiver.Character.Client, Crafter.Character, Job);
            }

            else if (trader == Receiver && !isready) // stop the trade
            {
                foreach (var item in Crafter.Items.OfType <PlayerTradeItem>().ToArray())
                {
                    if (Crafter.Character == item.Owner)
                    {
                        Crafter.MoveItemToInventory(item, 0);
                    }
                    else if (item.Owner == Receiver.Character)
                    {
                        RuneCrafter.MoveItemFromBag(item.PlayerItem, Receiver, 0);
                    }
                }

                /*
                 * if (Rune != null && Rune.Trader == Receiver)
                 *  Rune.Trader.MoveItem(Rune.Guid, (int) -Rune.Stack);
                 *
                 * var itemToImprove = ItemToImprove;
                 * Crafter.MoveItem(itemToImprove.Guid, (int) -itemToImprove.Stack);
                 * Receiver.MoveItem(itemToImprove.Guid, (int) itemToImprove.Stack);*/
            }
        }
Ejemplo n.º 2
0
        public void MoveItemFromBag(int id, int quantity)
        {
            if (!Receiver.ReadyToApply)
            {
                return;
            }

            var item = Receiver.Character.Inventory[id];

            if (item != null)
            {
                RuneCrafter.MoveItemFromBag(item, Receiver, quantity);
                Receiver.MoveItem(id, -quantity);
            }
        }
Ejemplo n.º 3
0
        public override void Close()
        {
            foreach (var item in Crafter.Items.OfType <PlayerTradeItem>().ToArray())
            {
                if (Crafter.Character == item.Owner)
                {
                    Crafter.MoveItemToInventory(item, 0);
                }
                else if (item.Owner == Receiver.Character)
                {
                    RuneCrafter.MoveItemFromBag(item.PlayerItem, Receiver, 0);
                }
            }

            Crafter.Character.ResetDialog();
            Receiver.Character.ResetDialog();
            InventoryHandler.SendExchangeLeaveMessage(Clients, DialogType, false);
        }
Ejemplo n.º 4
0
 public SingleRuneMagicCraftDialog(Character character, InteractiveObject interactive, Skill skill)
     : base(interactive, skill, character.Jobs[skill.SkillTemplate.ParentJobId])
 {
     Crafter = new RuneCrafter(this, character);
     Clients = new WorldClientCollection(character.Client);
 }