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);

                FirstTrader.ToggleReady(false);
                SecondTrader.ToggleReady(false);

                return;
            }

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

                Crafter.Character.Inventory.AddKamas(-Receiver.Character.Inventory.SubKamas((int)Receiver.Kamas));
                Receiver.SetKamas(0);

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

                FirstTrader.ToggleReady(false);
                SecondTrader.ToggleReady(false);
            }
        }
Ejemplo n.º 2
0
        protected override void OnTraderReadyStatusChanged(Trader trader, bool status)
        {
            base.OnTraderReadyStatusChanged(trader, status);

            InventoryHandler.SendExchangeIsReadyMessage(FirstTrader.Character.Client,
                                                        trader, status);

            if (trader is PlayerTrader && status)
            {
                SecondTrader.ToggleReady(true);
            }
        }
Ejemplo n.º 3
0
        private void OnItemMoved(Trader trader, TradeItem item, bool modified, int difference)
        {
            if (!modified && item.Stack > 0)
            {
                InventoryHandler.SendExchangeObjectAddedMessage(Crafter.Character.Client, Crafter != trader, item);
                InventoryHandler.SendExchangeObjectAddedMessage(Receiver.Character.Client, Receiver != trader, item);
            }
            else if (item.Stack <= 0)
            {
                InventoryHandler.SendExchangeObjectRemovedMessage(Crafter.Character.Client, Crafter != trader, item.Guid);
                InventoryHandler.SendExchangeObjectRemovedMessage(Receiver.Character.Client, Receiver != trader, item.Guid);
            }
            else
            {
                InventoryHandler.SendExchangeObjectModifiedMessage(Crafter.Character.Client, Crafter != trader, item);
                InventoryHandler.SendExchangeObjectModifiedMessage(Receiver.Character.Client, Receiver != trader, item);
            }


            FirstTrader.ToggleReady(false);
            SecondTrader.ToggleReady(false);
        }
Ejemplo n.º 4
0
        protected override void OnTraderItemMoved(Trader trader, TradeItem item, bool modified, int difference)
        {
            base.OnTraderItemMoved(trader, item, modified, difference);

            FirstTrader.ToggleReady(false);
            SecondTrader.ToggleReady(false);

            if (item.Stack == 0)
            {
                InventoryHandler.SendExchangeObjectRemovedMessage(FirstTrader.Character.Client, trader != FirstTrader, item.Guid);
                InventoryHandler.SendExchangeObjectRemovedMessage(SecondTrader.Character.Client, trader != SecondTrader, item.Guid);
            }
            else if (modified)
            {
                InventoryHandler.SendExchangeObjectModifiedMessage(FirstTrader.Character.Client, trader != FirstTrader, item);
                InventoryHandler.SendExchangeObjectModifiedMessage(SecondTrader.Character.Client, trader != SecondTrader, item);
            }
            else
            {
                InventoryHandler.SendExchangeObjectAddedMessage(FirstTrader.Character.Client, trader != FirstTrader, item);
                InventoryHandler.SendExchangeObjectAddedMessage(SecondTrader.Character.Client, trader != SecondTrader, item);
            }
        }
Ejemplo n.º 5
0
 protected virtual void OnTraderKamasChanged(Trader trader, uint amount)
 {
     FirstTrader.ToggleReady(false);
     SecondTrader.ToggleReady(false);
 }
Ejemplo n.º 6
0
 protected virtual void OnTraderItemMoved(Trader trader, TradeItem item, bool modified, int difference)
 {
     FirstTrader.ToggleReady(false);
     SecondTrader.ToggleReady(false);
 }