Beispiel #1
0
 public override void onLaunchWeapon(Fighter Launcher, Database.Models.InventoryItemModel Weapon, int TargetCellId, Fighter TargetFighter, Dictionary <Character.WeaponEffect, List <Fighter> > TargetEffects, bool IsCC, bool IsEchec, bool isPunch)
 {
     if (Launcher.Team != Fight.Team1)
     {
         return;
     }
     foreach (var TargetEffect in TargetEffects)
     {
         if (TargetEffect.Key.EffectType == EffectEnum.SubPO || TargetEffect.Key.EffectType == EffectEnum.VolPO)
         {
             if (TargetEffect.Value.Any(x => x.Team != Launcher.Team))
             {
                 Failure(Launcher);
                 break;
             }
         }
     }
 }
Beispiel #2
0
 public override void onLaunchWeapon(Fighter Launcher, Database.Models.InventoryItemModel Weapon, int TargetCellId, Fighter TargetFighter, Dictionary <Character.WeaponEffect, List <Fighter> > TargetEffects, bool IsCC, bool IsEchec, bool isPunch)
 {
     if (Launcher.Team != Fight.Team1)
     {
         return;
     }
     if (lastAction == 0)
     {
         lastAction = -1;
     }
     else
     {
         if (lastAction != -1)
         {
             Failure(Launcher);
         }
     }
 }
Beispiel #3
0
 public override void onLaunchWeapon(Fighter Launcher, Database.Models.InventoryItemModel Weapon, int TargetCellId, Fighter TargetFighter, Dictionary <Character.WeaponEffect, List <Fighter> > TargetEffects, bool IsCC, bool IsEchec, bool isPunch)
 {
     if (Launcher.Team != Fight.Team1)
     {
         return;
     }
     if (IsEchec)
     {
         return;
     }
     if (!UsedSpells.ContainsKey(Launcher))
     {
         UsedSpells.Add(Launcher, new List <int>());
     }
     if (UsedSpells[Launcher].Contains(-1))
     {
         Failure(Launcher);
     }
     else
     {
         UsedSpells[Launcher].Add(-1);
     }
 }
Beispiel #4
0
        public override bool MoveItem(Network.WorldClient Client, Database.Models.InventoryItemModel Item, ushort Quantity, bool Add = false)
        {
            if (Add)
            {
                if (Quantity > Item.Quantity)
                {
                    Quantity = (ushort)Item.Quantity;
                }

                InventoryItemModel ObjectEqualize = getSimilarItem(Item);
                int    newQua = Item.Quantity - Quantity;
                String str;

                if (ObjectEqualize == null)
                {
                    if (newQua <= 0)
                    {
                        Client.Character.InventoryCache.RemoveItem(Item);
                        Mount.Items.Add(Item);
                        str = "O+" + Item.ID + "|" + Item.Quantity + "|" + Item.TemplateID + "|" + Item.GetStats().ToItemStats();
                        Client.Send(new ObjectRemoveMessage(Item.ID));
                    }
                    else
                    {
                        Client.Character.InventoryCache.UpdateObjectquantity(Item, newQua);
                        ObjectEqualize = InventoryItemTable.TryCreateItem(Item.TemplateID, Mount, Quantity, Stats: Item.Effects);
                        str            = "O+" + ObjectEqualize.ID + "|" + ObjectEqualize.Quantity + "|" + ObjectEqualize.TemplateID + "|" + ObjectEqualize.GetStats().ToItemStats();
                    }
                }
                else if (newQua <= 0)
                {
                    Client.Character.InventoryCache.RemoveItem(Item);
                    ObjectEqualize.Quantity += Item.Quantity;
                    InventoryItemTable.removeItem(Item.ID);
                    str = "O+" + ObjectEqualize.ID + "|" + ObjectEqualize.Quantity + "|" + ObjectEqualize.TemplateID + "|" + ObjectEqualize.GetStats().ToItemStats();
                    Client.Send(new ObjectRemoveMessage(Item.ID));
                    InventoryItemTable.Update(ObjectEqualize);
                }
                else
                {
                    Client.Character.InventoryCache.UpdateObjectquantity(Item, newQua);
                    ObjectEqualize.Quantity += Quantity;
                    str = "O+" + ObjectEqualize.ID + "|" + ObjectEqualize.Quantity + "|" + ObjectEqualize.TemplateID + "|" + ObjectEqualize.GetStats().ToItemStats();
                    InventoryItemTable.Update(ObjectEqualize);
                }
                Client.Send(new BankUpdateMessage(str));
                Client.Send(new InventoryWeightMessage(0, 2000)); // TODO PODS
                Client.Send(new MountActualPodMessage(Mount));
                MountTable.Update(Mount);
            }
            else
            {
                if (!Mount.Items.Contains(Item))
                {
                    return(false);
                }
                InventoryItemModel ObjectEqualize = Client.Character.InventoryCache.getSimilarInventoryItem(Item);
                int    newQua = Item.Quantity - Quantity;
                String str;

                if (ObjectEqualize == null)
                {
                    if (newQua <= 0)
                    {
                        Mount.Items.Remove(Item);
                        if (Client.Character.InventoryCache.TryMergeItem(Item.TemplateID, Item.GetStats().ToItemStats(), Item.Slot, Item.Quantity))
                        {
                            InventoryItemTable.removeItem(Item.ID);
                        }
                        else
                        {
                            Client.Character.InventoryCache.Add(Item);
                        }
                        str = "O-" + Item.ID;
                    }
                    else
                    {
                        ObjectEqualize = InventoryItemTable.TryCreateItem(Item.TemplateID, Client.Character, Quantity, Stats: Item.Effects);
                        Item.Quantity  = newQua;
                        str            = "O+" + Item.ID + "|" + Item.Quantity + "|" + Item.TemplateID + "|" + Item.GetStats().ToItemStats();
                    }
                }
                else if (newQua <= 0)
                {
                    Mount.Items.Remove(Item);
                    ObjectEqualize.Quantity += Item.Quantity;
                    Client.Send(new ObjectQuantityMessage(ObjectEqualize.ID, ObjectEqualize.Quantity));
                    InventoryItemTable.removeItem(Item.ID);
                    str = "O-" + Item.ID;
                    InventoryItemTable.Update(ObjectEqualize);
                }
                else
                {
                    Item.Quantity            = newQua;
                    ObjectEqualize.Quantity += Quantity;
                    Client.Send(new ObjectQuantityMessage(ObjectEqualize.ID, ObjectEqualize.Quantity));
                    str = "O+" + Item.ID + "|" + Item.Quantity + "|" + Item.TemplateID + "|" + Item.GetStats().ToItemStats();
                    InventoryItemTable.Update(ObjectEqualize);
                }
                Client.Send(new BankUpdateMessage(str));
                Client.Send(new InventoryWeightMessage(0, 2000)); // TODO PODS
                Client.Send(new MountActualPodMessage(Mount));
                MountTable.Update(Mount);
            }
            return(true);
        }
Beispiel #5
0
 public override bool SellItem(Network.WorldClient Client, Database.Models.InventoryItemModel Item, ushort Quantity)
 {
     return(false);
 }
Beispiel #6
0
 public override void onLaunchWeapon(Fighter Launcher, Database.Models.InventoryItemModel Weapon, int TargetCellId, Fighter TargetFighter, Dictionary <Character.WeaponEffect, List <Fighter> > TargetEffects, bool IsCC, bool IsEchec, bool isPunch)
 {
 }
Beispiel #7
0
        public override bool MoveItem(Network.WorldClient Client, Database.Models.InventoryItemModel Item, ushort Quantity, bool Add = false)
        {
            if (!Add)
            {
                if (!Npc.Items.ContainsKey(Item.ID))
                {
                    return(false);
                }
                InventoryItemModel ObjectEqualize = Client.Character.InventoryCache.getSimilarInventoryItem(Item);
                int    newQua = Item.Quantity - Quantity;
                String str;

                if (ObjectEqualize == null)
                {
                    if (newQua <= 0)
                    {
                        Npc.Items.Remove(Item.ID);
                        if (Client.Character.InventoryCache.TryMergeItem(Item.TemplateID, Item.GetStats().ToItemStats(), Item.Slot, Item.Quantity))
                        {
                            InventoryItemTable.removeItem(Item.ID);
                        }
                        else
                        {
                            Client.Character.InventoryCache.Add(Item);
                        }
                        str = "O-" + Item.ID;
                    }
                    else
                    {
                        ObjectEqualize = InventoryItemTable.TryCreateItem(Item.TemplateID, Client.Character, Quantity, Stats: Item.Effects);
                        Item.Quantity  = newQua;
                        str            = "O+" + Item.ID + "|" + Item.Quantity + "|" + Item.TemplateID + "|" + Item.GetStats().ToItemStats();
                    }
                }
                else if (newQua <= 0)
                {
                    Npc.Items.Remove(Item.ID);
                    ObjectEqualize.Quantity += Item.Quantity;
                    Client.Send(new ObjectQuantityMessage(ObjectEqualize.ID, ObjectEqualize.Quantity));
                    InventoryItemTable.removeItem(Item.ID);
                    str = "O-" + Item.ID;
                    InventoryItemTable.Update(ObjectEqualize);
                }
                else
                {
                    Item.Quantity            = newQua;
                    ObjectEqualize.Quantity += Quantity;
                    Client.Send(new ObjectQuantityMessage(ObjectEqualize.ID, ObjectEqualize.Quantity));
                    str = "O+" + Item.ID + "|" + Item.Quantity + "|" + Item.TemplateID + "|" + Item.GetStats().ToItemStats();
                    InventoryItemTable.Update(ObjectEqualize);
                }
                Client.Send(new BankUpdateMessage(str));
                Client.Send(new InventoryWeightMessage(0, 2000)); // TODO PODS
                TaxCollectorTable.Update(Npc);

                Npc.LogItems.Add(Item.ID, Item);
            }
            Client.GetCharacter().AddExperience(Npc.XP);
            Npc.LogXP += Npc.XP;
            Npc.XP     = 0;
            TaxCollectorTable.Update(Npc);

            return(true);
        }
Beispiel #8
0
 public override bool MoveItem(WorldClient Client, Database.Models.InventoryItemModel Item, ushort Quantity, bool Add = false)
 {
     if (Add)
     {
         long Taxe = (long)(Price * (Market.SellTaxe / 100));
         if (myClient.Account.Data.canTaxBidHouseItem(Market.HdvID) >= Market.countItem)
         {
             myClient.Send(new TextInformationMessage(Libs.Enumerations.TextInformationTypeEnum.INFO, 58));
             return(false);
         }
         if (myClient.Character.Kamas < Taxe)
         {
             myClient.Send(new TextInformationMessage(Libs.Enumerations.TextInformationTypeEnum.ERREUR, 76));
             return(false);
         }
         myClient.Character.InventoryCache.SubstractKamas(Taxe);
         int cantReal  = (int)(Math.Pow(10, Quantity) / 10);
         int nuevaCant = Item.Quantity - cantReal;
         if (nuevaCant <= 0)
         {
             myClient.Character.InventoryCache.RemoveItem(Item);
             myClient.Character.Send(new ObjectRemoveMessage(Item.ID));
         }
         else
         {
             Item.Quantity -= cantReal;
             myClient.Send(new ObjectQuantityMessage(Item.ID, Item.Quantity));
             Item = InventoryItemTable.TryCreateItem(Item.TemplateID, quantity: cantReal, Stats: Item.GetStats().ToItemStats());
         }
         var MarketItem = new BidHouseItem()
         {
             Price    = Price,
             Quantity = Quantity,
             Owner    = myClient.Account.ID,
             Item     = Item,
         };
         Market.addObject(MarketItem);
         BidHouseTable.Add(MarketItem);
         myClient.Send(new ExchangeMoveDistantObject('+', "", MarketItem.SerializeAsDisplayEquipmentOnMarket()));
         Client.Send(new AccountStatsMessage(myClient.Character));
     }
     else
     {
         var          MarketID = Market.HdvID;
         BidHouseItem BHI      = null;
         try
         {
             foreach (var BH in myClient.Account.Data.BHI[MarketID])
             {
                 if (BH.LineID == ItemID)
                 {
                     BHI = BH;
                     break;
                 }
             }
         }
         catch (Exception e)
         {
             return(false);
         }
         if (BHI == null)
         {
             return(false);
         }
         myClient.Account.Data.BHI[MarketID].Remove(BHI);
         var Object = BHI.Item;
         myClient.Character.InventoryCache.Add(Object);
         Market.DestroyObject(BHI);
         BidHouseTable.Delete(BHI.ItemID);
         myClient.Send(new ExchangeMoveDistantObject('-', "", ItemID + ""));
     }
     return(true);
 }