当前位置: 首页>>代码示例>>C#>>正文


C# Client.CalculateStatBonus方法代码示例

本文整理汇总了C#中Client.CalculateStatBonus方法的典型用法代码示例。如果您正苦于以下问题:C# Client.CalculateStatBonus方法的具体用法?C# Client.CalculateStatBonus怎么用?C# Client.CalculateStatBonus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Client的用法示例。


在下文中一共展示了Client.CalculateStatBonus方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateEntity

        public static bool CreateEntity(Network.GamePackets.EnitityCreate eC, Client.GameState client, ref string message)
        {
            if (eC.Name.Length > 16)
                eC.Name = eC.Name.Substring(0, 16);
            if (eC.Name == "")
                return false;

            if (InvalidCharacters(eC.Name))
            {
                message = "Invalid characters inside the name.";
                return false;
            }
            var rdr = new MySqlReader(new MySqlCommand(MySqlCommandType.SELECT).Select("entities").Where("name", eC.Name));
            if (rdr.Read())
            {
                rdr.Close();
                message = "The chosen name is already in use.";
                return false;
            }
            rdr.Close();
            client.Entity = new Game.Entity(Game.EntityFlag.Player, false);
            client.Entity.Name = eC.Name;
            DataHolder.GetStats(eC.Class, 1, client);
            client.Entity.UID = Program.EntityUID.Next;
            new MySqlCommand(MySqlCommandType.UPDATE).Update("configuration").Set("EntityID", client.Entity.UID).Where("Server", ServerBase.Constants.ServerName).Execute();
            client.CalculateStatBonus();
            client.CalculateHPBonus();
            client.Entity.Hitpoints = client.Entity.MaxHitpoints;
            client.Entity.Mana = (ushort)(client.Entity.Spirit * 5);
            client.Entity.Class = eC.Class;
            client.Entity.Body = eC.Body;
            if (eC.Body == 1003 || eC.Body == 1004)
                client.Entity.Face = (ushort)ServerBase.Kernel.Random.Next(1, 50);
            else
                client.Entity.Face = (ushort)ServerBase.Kernel.Random.Next(201, 250);
            byte Color = (byte)ServerBase.Kernel.Random.Next(4, 8);
            client.Entity.HairStyle = (ushort)(Color * 100 + 10 + (byte)ServerBase.Kernel.Random.Next(4, 9));
            client.Account.EntityID = client.Entity.UID;
            client.Account.Save();
            //723753

            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT);
            cmd.Insert("entities").Insert("Name", eC.Name).Insert("Owner", client.Account.Username).Insert("Class", eC.Class).Insert("UID", client.Entity.UID)
                .Insert("Hitpoints", client.Entity.Hitpoints).Insert("Mana", client.Entity.Mana).Insert("Body", client.Entity.Body)
                .Insert("Face", client.Entity.Face).Insert("HairStyle", client.Entity.HairStyle).Insert("Strength", client.Entity.Strength)
                .Insert("Agility", client.Entity.Agility).Insert("Vitality", client.Entity.Vitality).Insert("Spirit", client.Entity.Spirit);

            cmd.Execute();
            message = "ANSWER_OK";

            return true;
        }
开发者ID:faresali,项目名称:co-pserver,代码行数:52,代码来源:EntityTable.cs

示例2: Reincarnation

        public Reincarnation(Client.GameState client, byte new_class)
        {
            if (client.Entity.Level < 130)
                return;
            _client = client;
            RemoveSkill = new SafeDictionary<ushort, PhoenixProject.Interfaces.ISkill>(500);
            Addskill = new SafeDictionary<ushort, PhoenixProject.Interfaces.ISkill>(500);
            #region Low level items
            for (byte i = 1; i < 9; i++)
            {
                if (i != 7)
                {
                    Interfaces.IConquerItem item = client.Equipment.TryGetItem(i);
                    if (item != null && item.ID != 0)
                    {
                        try

                        {
                            //client.UnloadItemStats(item, false);
                            Database.ConquerItemInformation cii = new PhoenixProject.Database.ConquerItemInformation(item.ID, item.Plus);
                            item.ID = cii.LowestID(Network.PacketHandler.ItemMinLevel(Network.PacketHandler.ItemPosition(item.ID)));
                            item.Mode = PhoenixProject.Game.Enums.ItemMode.Update;
                            item.Send(client);
                            client.LoadItemStats(client.Entity);
                            Database.ConquerItemTable.UpdateItemID(item, client);
                        }
                        catch
                        {
                            Console.WriteLine("Reborn item problem: " + item.ID);
                        }
                    }
                }
            }
            Interfaces.IConquerItem hand = client.Equipment.TryGetItem(5);
            if (hand != null)
            {
                client.Equipment.Remove(5);
                client.CalculateStatBonus();
                client.CalculateHPBonus();
                client.SendStatMessage();
            }
            else
                //client.Screen.send(client.Entity.SpawnPacket, false);
            #endregion

            #region Remove Extra Skill
            if (client.Entity.FirstRebornClass == 15 && client.Entity.SecondRebornClass == 15 && client.Entity.Class == 15)
            {
                WontAdd(PhoenixProject.Game.Enums.SkillIDs.DragonWhirl);
            }
            if (client.Entity.FirstRebornClass == 25 && client.Entity.SecondRebornClass == 25 && client.Entity.Class == 25)
            {
                WontAdd(PhoenixProject.Game.Enums.SkillIDs.Perseverance);
            }
            if (client.Entity.FirstRebornClass == 45 && client.Entity.SecondRebornClass == 45 && client.Entity.Class == 45)
            {
                WontAdd(PhoenixProject.Game.Enums.SkillIDs.StarArrow);
            }
            if (client.Entity.FirstRebornClass == 55 && client.Entity.SecondRebornClass == 55 && client.Entity.Class == 55)
            {
                WontAdd(PhoenixProject.Game.Enums.SkillIDs.PoisonStar);
            }
            if (client.Entity.FirstRebornClass == 65 && client.Entity.SecondRebornClass == 65 && client.Entity.Class == 65)
            {
                WontAdd(PhoenixProject.Game.Enums.SkillIDs.SoulShackle);
            }
            if (client.Entity.FirstRebornClass == 135 && client.Entity.SecondRebornClass == 135 && client.Entity.Class == 135)
            {
                WontAdd(PhoenixProject.Game.Enums.SkillIDs.AzureShield);
            }
            if (client.Entity.FirstRebornClass == 145 && client.Entity.SecondRebornClass == 145 && client.Entity.Class == 145)
            {
                WontAdd(PhoenixProject.Game.Enums.SkillIDs.HeavenBlade);
            }
            #endregion
            Database.ReincarnationTable.NewReincarnated(client.Entity);
            Game.Features.Reincarnation.ReincarnateInfo info = new Game.Features.Reincarnation.ReincarnateInfo();
            info.UID = client.Entity.UID;
            info.Level = client.Entity.Level;
            info.Experience = client.Entity.Experience;
            ServerBase.Kernel.ReincarnatedCharacters.Add(info.UID, info);
            client.Entity.FirstRebornClass = client.Entity.SecondRebornClass;
            client.Entity.SecondRebornClass = client.Entity.Class;
            client.Entity.Class = new_class;
            client.Entity.SecondRebornLevel = client.Entity.Level;
            client.Entity.Level = 15;
            client.Entity.Experience = 0;
            client.Entity.Atributes =
             (ushort)(client.ExtraAtributePoints(client.Entity.FirstRebornClass, client.Entity.FirstRebornLevel) +
              client.ExtraAtributePoints(client.Entity.SecondRebornClass, client.Entity.SecondRebornLevel) + 62);

            client.Spells.Clear();
            client.Spells = new SafeDictionary<ushort, PhoenixProject.Interfaces.ISkill>(100);
            switch (client.Entity.FirstRebornClass)
            {
                case 15:
                    {
                        Add(PhoenixProject.Game.Enums.SkillIDs.Cyclone);
                        Add(PhoenixProject.Game.Enums.SkillIDs.Hercules);
                        Add(PhoenixProject.Game.Enums.SkillIDs.SpiritHealing);
//.........这里部分代码省略.........
开发者ID:Mromany,项目名称:Conquista5679-TheHunterSource-,代码行数:101,代码来源:Handle.cs

示例3: HandlePacket


//.........这里部分代码省略.........
                                                                client.Inventory.Remove(key, PhoenixProject.Game.Enums.ItemUse.Remove, true);
                                                        }
                                                        client.Inventory.Add(ItemAdd, 0, 1);

                                                    }
                                                }
                                                break;
                                            }
                                        case 52:
                                            {
                                                var item = Database.ConquerItemTable.LoadItem(usage.UID);
                                                item.Mode = PhoenixProject.Game.Enums.ItemMode.ChatItem;
                                                item.Send(client);
                                                break;
                                            }
                                        case 41:
                                            {
                                                // var item = Database.ConquerItemTable.LoadItem(usage.UID);
                                                usage.dwParam = 1;
                                                client.Send(usage);
                                                break;
                                            }
                                        case ItemUsage.SwitchEquipsBack:
                                        case ItemUsage.SwitchEquips:
                                            {
                                                client.AlternateEquipment = usage.ID == ItemUsage.SwitchEquips;
                                                if (usage.ID == 45)
                                                {
                                                    ClientEquip equips = new ClientEquip(client);
                                                    client.Send(equips);
                                                    client.Equipment.UpdateEntityPacket2();

                                                    client.LoadItemStats2(client.Entity);
                                                    client.CalculateStatBonus();
                                                    client.CalculateHPBonus();
                                                    client.Send(WindowStats(client));
                                                }
                                                else
                                                {
                                                    ClientEquip equips = new ClientEquip();
                                                    equips.DoEquips(client);
                                                    client.Send(equips);
                                                    client.Equipment.UpdateEntityPacket();

                                                    client.LoadItemStats(client.Entity);
                                                    client.CalculateStatBonus();
                                                    client.CalculateHPBonus();
                                                    client.Send(WindowStats(client));
                                                }
                                                usage.dwParam = 1;
                                                client.Send(usage);
                                                break;
                                            }
                                        case ItemUsage.ArrowReload:
                                            {
                                                ReloadArrows(client.Equipment.TryGetItem(ConquerItem.LeftWeapon), client);
                                                break;
                                            }
                                        case ItemUsage.ShowBoothItems:
                                            {
                                                ShowBoothItems(usage, client);
                                                break;
                                            }
                                        case ItemUsage.AddItemOnBoothForSilvers:
                                        case ItemUsage.AddItemOnBoothForConquerPoints:
                                            {
开发者ID:Mromany,项目名称:Conquista5679-TheHunterSource-,代码行数:67,代码来源:PacketHandler.cs

示例4: EquipItem


//.........这里部分代码省略.........
                            if (twohand)
                                client.Equipment.Remove(5);
                            item.Position = (byte)itemUsage.dwParam;
                            if (!client.AlternateEquipment)
                            {
                                client.Equipment.Add(item);
                            }
                            else
                            {
                                client.Equipment.Add505(item);
                            }
                            item.Mode = Game.Enums.ItemMode.Update;
                            item.Send(client);
                        }
                        else
                        {
                            if (twohand)
                                client.Equipment.Remove(5);
                            client.Equipment.Remove((byte)itemUsage.dwParam);
                            item.Position = (byte)itemUsage.dwParam;
                            if (!client.AlternateEquipment)
                            {
                                client.Equipment.Add(item);
                            }
                            else
                            {
                                client.Equipment.Add505(item);
                            }
                        }

                        if (!client.AlternateEquipment)
                        {
                            client.LoadItemStats(client.Entity);
                            client.CalculateStatBonus();
                            client.CalculateHPBonus();
                            ClientEquip equips = new ClientEquip();
                            equips.DoEquips(client);
                            client.Send(equips);
                            client.Equipment.UpdateEntityPacket();
                        }
                        else
                        {
                            ClientEquip equips = new ClientEquip(client);
                            //equips.DoEquips(client);
                            client.Send(equips);
                            client.Equipment.UpdateEntityPacket2();
                        }

                        Database.ConquerItemTable.UpdateLocation(item, client);
                    }
                }
                else
                {
                    Interfaces.IConquerItem item = null;
                    client.Entity.AttackPacket = null;

                    if (client.Inventory.TryGetItem(itemUsage.UID, out item) && client.Booth == null)
                    {
                        if (item.Suspicious)
                            return;

                        Positions pos = GetPositionFromID2(item.ID);
                        if (client.Entity.MapID == 2060)
                        {
                            if (pos == Positions.AltGarment)
                            {
开发者ID:Mromany,项目名称:Conquista5679-TheHunterSource-,代码行数:67,代码来源:PacketHandler.cs

示例5: CheckCommand


//.........这里部分代码省略.........
                                    }
                                    break;
                                }
                            case "online":
                                {
                                    client.Send(new Message("Online players count: " + ServerBase.Kernel.GamePool.Count, System.Drawing.Color.BurlyWood, GamePackets.Message.TopLeft));
                                    string line = "";
                                    foreach (Client.GameState pClient in ServerBase.Kernel.GamePool.Values)
                                        line += pClient.Entity.Name + ",";

                                    if (line.Length >= 255)
                                        return true;
                                    client.Send(new GamePackets.Message(line, System.Drawing.Color.Beige, GamePackets.Message.Talk));
                                    break;
                                }
                            case "reallot":
                                {
                                    if (client.Entity.Reborn != 0)
                                    {
                                        client.Entity.Agility = 0;
                                        client.Entity.Strength = 0;
                                        client.Entity.Vitality = 1;
                                        client.Entity.Spirit = 0;
                                        if (client.Entity.Reborn == 1)
                                        {
                                            client.Entity.Atributes = (ushort)(client.ExtraAtributePoints(client.Entity.FirstRebornLevel, client.Entity.FirstRebornLevel)
                                                + 52 + 3 * (client.Entity.Level - 15));
                                        }
                                        else
                                        {
                                            client.Entity.Atributes = (ushort)(client.ExtraAtributePoints(client.Entity.FirstRebornLevel, client.Entity.FirstRebornClass) +
                                                client.ExtraAtributePoints(client.Entity.SecondRebornLevel, client.Entity.SecondRebornClass) + 52 + 3 * (client.Entity.Level - 15));
                                        }
                                        client.CalculateStatBonus();
                                        client.CalculateHPBonus();
                                    }
                                    break;
                                }
                            case "str":
                                {
                                    ushort atr = 0;
                                    ushort.TryParse(Data[1], out atr);
                                    if (client.Entity.Atributes >= atr)
                                    {
                                        client.Entity.Strength += atr;
                                        client.Entity.Atributes -= atr;
                                        client.CalculateStatBonus();
                                        client.CalculateHPBonus();
                                    }
                                    break;
                                }
                            case "agi":
                                {
                                    ushort atr = 0;
                                    ushort.TryParse(Data[1], out atr);
                                    if (client.Entity.Atributes >= atr)
                                    {
                                        client.Entity.Agility += atr;
                                        client.Entity.Atributes -= atr;
                                        client.CalculateStatBonus();
                                        client.CalculateHPBonus();
                                    }
                                    break;
                                }
                            case "vit":
                                {
开发者ID:Mromany,项目名称:Conquista5679-TheHunterSource-,代码行数:67,代码来源:PacketHandler.cs

示例6: UnequipItem

        public static void UnequipItem(ItemUsage usage, Client.GameState client)
        {
            Positions pos = GetPositionFromID(usage.UID);
            if (client.Entity.MapID == 2060)
            {
                if (usage.dwParam == 9)
                {
                    return;
                }
            }
            if (client.Entity.MapID == 7009)
            {
                if (usage.dwParam == 9)
                {
                    return;
                }
            }
            if (client.Equipment.Remove((byte)usage.dwParam))
            {
                if (client.Map.ID == 1039)
                    client.Entity.AttackPacket = null;
                if (!client.AlternateEquipment)
                {
                    client.LoadItemStats(client.Entity);
                    client.CalculateStatBonus();
                    client.CalculateHPBonus();
                    ClientEquip equips = new ClientEquip();
                    equips.DoEquips(client);
                    client.Send(equips);
                    client.Equipment.UpdateEntityPacket();
                }
                else
                {
                    client.LoadItemStats2(client.Entity);
                    client.CalculateStatBonus();
                    client.CalculateHPBonus();

                    ClientEquip equips = new ClientEquip(client);
                    client.Send(equips);
                    client.Equipment.UpdateEntityPacket2();
                }
            }
        }
开发者ID:Mromany,项目名称:Conquista5679-TheHunterSource-,代码行数:43,代码来源:PacketHandler.cs

示例7: Reincarnation


//.........这里部分代码省略.........
                    client.RemoveSpell(new Spell(true) { ID = 6002 });
                }
                if (client.Entity.Class == 132)
                {
                    client.RemoveSpell(new Spell(true) { ID = 6002 });
                }
                #endregion

                #region Proficiencies
                foreach (Interfaces.ISkill proficiency in client.Proficiencies.Values)
                {
                    proficiency.PreviousLevel = proficiency.Level;
                    proficiency.Level = 0;
                    proficiency.Experience = 0;
                    proficiency.Send(client);
                }
                #endregion
                #region Low level items
                for (byte i = 1; i < 9; i++)
                {
                    if (i != 7)
                    {
                        Interfaces.IConquerItem item = client.Equipment.TryGetItem(i);
                        if (item != null && item.ID != 0)
                        {
                            try
                            {
                                //client.UnloadItemStats(item, false);
                                Database.ConquerItemInformation cii = new PhoenixProject.Database.ConquerItemInformation(item.ID, item.Plus);
                                item.ID = cii.LowestID(Network.PacketHandler.ItemMinLevel(Network.PacketHandler.ItemPosition(item.ID)));
                                item.Mode = PhoenixProject.Game.Enums.ItemMode.Update;
                                item.Send(client);
                                client.LoadItemStats(client.Entity);
                                client.CalculateStatBonus();
                                client.CalculateHPBonus();
                                Database.ConquerItemTable.UpdateItemID(item, client);
                            }
                            catch
                            {
                                Console.WriteLine("Reborn item problem: " + item.ID);
                            }
                        }
                    }
                }
                #region Alt Fix By Amjad
                Interfaces.IConquerItem AltRing = client.Equipment.TryGetItem(26);
                if (AltRing != null)
                {
                    client.Equipment.Remove(26);
                    client.CalculateStatBonus();
                    client.CalculateHPBonus();
                }
                else
                    client.SendScreen(client.Entity.SpawnPacket, false);
                Interfaces.IConquerItem AltRightHand = client.Equipment.TryGetItem(24);
                if (AltRightHand != null)
                {
                    client.Equipment.Remove(24);
                    client.CalculateStatBonus();
                    client.CalculateHPBonus();
                }
                else
                    client.SendScreen(client.Entity.SpawnPacket, false);
                Interfaces.IConquerItem AltNecklace = client.Equipment.TryGetItem(22);
                if (AltNecklace != null)
                {
开发者ID:Mromany,项目名称:Conquista5679-TheHunterSource-,代码行数:67,代码来源:PacketHandler.cs

示例8: PurifyRefinery

        public static void PurifyRefinery(Purification ps, Client.GameState client)
        {
            Interfaces.IConquerItem item = null, refine = null;
            client.Inventory.TryGetItem(ps.ItemUID, out item);
            client.Inventory.TryGetItem(ps.AddUID, out refine);
            if (refine != null)
            {
                if (item == null)
                    item = client.Equipment.TryGetItem(ps.ItemUID);
                if (item != null)
                {
                    Refinery.RefineryItem refineStats;
                    if (Kernel.DatabaseRefinery.TryGetValue(refine.ID, out refineStats))
                    {
                        Boolean valid = true;
                        if (item.Position < 100)
                        {
                            UInt32 iType = item.ID / 1000;
                            Positions pos = GetPositionFromID(item.ID);
                            if (pos != (Positions)refineStats.Position)
                                valid = false;
                            if (pos == Positions.Garment)
                                return;
                            if (pos == Positions.Steed)
                                return;
                            if (pos == Positions.Bottle)
                                return;
                            if (pos == Positions.SteedArmor)
                                return;
                            if (pos == Positions.SteedTalisman)
                                return;
                            if (pos == Positions.LeftAccessory)
                                return;
                            if (pos == Positions.RightAccessory)
                                return;
                            if (pos == Positions.DefenceTalisman)
                                return;
                            if (pos == Positions.AttackTalisman)
                                return;
                            else if (refineStats.Position == 5)
                                valid = item.IsTwoHander();
                            if (iType == refineStats.Position)
                                valid = true;
                        }
                        else
                        {
                            if (item.GetItemType() != (ConquerItem.ItemTypes)refineStats.Position)
                                valid = false;
                        }

                        if (valid)
                        {
                            if (item.Position == 7)
                                return;
                            if (item.Position == 9)
                                return;
                            if (item.Position == 11)
                                return;
                            if (item.Position == 12)
                                return;
                            if (item.Position == 10)
                                return;
                            if (item.Position == 18)
                                return;
                            if (item.Position == 17)
                                return;
                            if (item.Position == 15)
                                return;
                            if (item.Position == 16)
                                return;
                            client.Inventory.Remove(refine, Game.Enums.ItemUse.Remove);
                            item.RefineItem = refineStats.Identifier;
                            item.Mode = Game.Enums.ItemMode.Update;
                            item.RefineryTime = DateTime.Now.AddDays(7);
                            item.Send(client);

                            client.LoadItemStats(client.Entity);
                            client.CalculateStatBonus();
                            client.CalculateHPBonus();

                            Database.ConquerItemTable.UpdateRefineryItem(item);
                            Database.ConquerItemTable.UpdateRefineryTime(item);

                            client.Send(WindowStats(client));
                            //LoadItemStatus(client);
                            // c.Send(new Game_HeroStats(c.Hero));
                        }
                        else
                            client.Send(new Message(String.Format("You cannot refine your {0} with that {1}.",
                                Database.ConquerItemInformation.BaseInformations[item.ID].Name, Database.ConquerItemInformation.BaseInformations[refine.ID].Name), System.Drawing.Color.Red, Message.TopLeft));
                    }
                    else
                        Console.WriteLine(String.Format("No database refinery {0}", refine.ID));
                }
            }
        }
开发者ID:Mromany,项目名称:Conquista5679-TheHunterSource-,代码行数:96,代码来源:PacketHandler.cs

示例9: PurifyItem

        public static void PurifyItem(Purification ps, Client.GameState client)
        {
            Interfaces.IConquerItem Item = null, AddingItem = null;
            if (client.Inventory.TryGetItem(ps.ItemUID, out Item) && client.Inventory.TryGetItem(ps.AddUID, out AddingItem))
            {
                if (ps.ItemUID == ps.AddUID)
                    return;

                var PurifyInformation = Database.ConquerItemInformation.BaseInformations[AddingItem.ID];
                var ItemInformation = Database.ConquerItemInformation.BaseInformations[Item.ID];
                if (PurifyInformation.PurificationLevel > 0)
                {
                    if (ItemInformation.Level >= PurifyInformation.Level)
                    {
                        if (client.Inventory.Contains(1088001, PurifyInformation.PurificationMeteorNeed))
                        {
                            client.Inventory.Remove(1088001, (byte)PurifyInformation.PurificationMeteorNeed);
                            if (Item.Purification.PurificationItemID > 0)
                                Database.ItemAddingTable.RemoveAdding(Item.UID, Item.Purification.PurificationItemID);
                            client.Send(ps);
                            ItemAdding.Purification_ purify = new ItemAdding.Purification_();
                            purify.AddedOn = DateTime.Now;
                            purify.Available = true;
                            purify.ItemUID = ps.ItemUID;
                            purify.PurificationLevel = PurifyInformation.PurificationLevel;
                            purify.PurificationDuration = 7 * 24 * 60 * 60;
                            purify.PurificationItemID = AddingItem.ID;
                            Database.ItemAddingTable.AddPurification(purify);
                            Item.Purification = purify;
                            Item.Mode = PhoenixProject.Game.Enums.ItemMode.Update;
                            Item.Send(client);
                            client.Inventory.Remove(AddingItem, PhoenixProject.Game.Enums.ItemUse.Remove);
                            client.LoadItemStats(client.Entity);
                            client.CalculateStatBonus();
                            client.CalculateHPBonus();
                            client.Send(ps);
                        }
                    }
                }
            }
        }
开发者ID:Mromany,项目名称:Conquista5679-TheHunterSource-,代码行数:41,代码来源:PacketHandler.cs

示例10: LoginMessages


//.........这里部分代码省略.........
            }

            if (client.Entity.Class >= 40 && client.Entity.Class <= 45)
            {
                if (client.Spells.ContainsKey(1025))
                {
                    client.RemoveSpell(new Spell(true) { ID = 1025 });//SuperMan
                }
            }
            if (client.Entity.Class >= 142 && client.Entity.Class <= 145)
            {
                if (client.Spells.ContainsKey(6002))
                {
                    client.RemoveSpell(new Spell(true) { ID = 6002 });//PiosnStar
                }
            }
            client.WentToComplete = true;
            client.Entity.SendUpdates = true;
            foreach (Interfaces.IConquerItem item in client.Inventory.Objects)
            {
                item.Send(client);
            }
            foreach (Interfaces.IConquerItem item in client.Equipment.Objects)
                if (item != null)
                {
                    if (Database.ConquerItemInformation.BaseInformations.ContainsKey(item.ID))
                    {
                        item.Send(client);
                        ItemUsage usage = new ItemUsage(true) { ID = ItemUsage.EquipItem };
                        usage.UID = item.UID;
                        usage.dwParam = item.Position;
                        client.Send(usage);
                        client.LoadItemStats(client.Entity);
                        client.CalculateStatBonus();
                        client.CalculateHPBonus();
                    }
                    else
                    {
                        client.Equipment.DestroyArrow(item.Position);
                    }
                }

            client.LoadItemStats(client.Entity);
            client.CalculateStatBonus();
            client.CalculateHPBonus();
            client.Equipment.UpdateEntityPacket();
            ClientEquip equips = new ClientEquip();
            equips.DoEquips(client);
            client.Send(equips);
            foreach (var Guild in ServerBase.Kernel.Guilds.Values)
            {
                Guild.SendName(client);
            }
            if (client.Entity.ClanId != 0 && client.Entity.ClanRank != 0 && client.Entity.ClanName != "")
            {
                if (client.Entity.Myclan != null)
                {
                    Network.GamePackets.Clan cl = new PhoenixProject.Network.GamePackets.Clan(client, 1);
                    client.Send(cl.ToArray());
                }
            }
            ServerTime time = new ServerTime();
            time.Year = (uint)DateTime.Now.Year;
            time.Month = (uint)DateTime.Now.Month;
            time.DayOfYear = (uint)DateTime.Now.DayOfYear;
            time.DayOfMonth = (uint)DateTime.Now.Day;
开发者ID:Mromany,项目名称:Conquista5679-TheHunterSource-,代码行数:67,代码来源:PacketHandler.cs

示例11: LoginMessages


//.........这里部分代码省略.........
            //        data.ID = Network.GamePackets.Data.OpenCustom;
            //        data.dwParam = Network.GamePackets.Data.CustomCommands.Minimize;
            //        client.Send(data);
            //        client.Send(new Message(ServerBase.Constants.ServerWebsite + ServerBase.Constants.WebAccExt + ServerBase.Constants.WebVoteExt, System.Drawing.Color.Red, Network.GamePackets.Message.Website));
            //    };
            //    client.Send(new NpcReply(NpcReply.MessageBox, "Would you like to consider voting for us? With more votes we will be come a bigger community."));
            //}

            /*if (client.Entity.VIPLevel != 0)
            {
                Database.PremiumTable.getVipInfo(client);
                if (client.VIPDays != 0)
                {
                    if (DateTime.Now >= client.VIPDate.AddDays(client.VIPDays))
                    {
                        client.Entity.VIPLevel = 0;
                        client.Send(ServerBase.Constants.VIPExpired);
                    }
                    else
                    {
                        DateTime VipEnds = client.VIPDate.AddDays(client.VIPDays);
                        TimeSpan span = VipEnds.Subtract(DateTime.Now);
                        client.Send(ServerBase.Constants.VIPRemaining(span.Days.ToString(), span.Hours.ToString()));
                    }
                }
                else
                    client.Send(ServerBase.Constants.VIPLifetime);
            }*/
            //if (Program.Today == DayOfWeek.Saturday || Program.Today == DayOfWeek.Sunday)
            //    client.Send(new Message("Double experience is on.", System.Drawing.Color.Red, Message.World));

            client.Send(new MapStatus() { BaseID = client.Map.BaseID, ID = client.Map.ID, Status = Database.MapsTable.MapInformations[client.Map.ID].Status });

            if (client.Entity.Hitpoints == 0)
                client.Entity.Hitpoints = 1;
            client.Entity.VIPLevel = (byte)(client.Entity.VIPLevel + 0);
            client.Entity.HandleTiming = true;
            if (client.Entity.ExtraBattlePower != 0)
                client.Entity.Update(Network.GamePackets.Update.ExtraBattlePower, client.Entity.ExtraBattlePower, false);
            if (client.Guild != null)
                client.Guild.SendAllyAndEnemy(client);
            if (Game.ConquerStructures.Broadcast.CurrentBroadcast.EntityID > 2)
                client.Send(new Network.GamePackets.Message(Game.ConquerStructures.Broadcast.CurrentBroadcast.Message, "ALLUSERS", Game.ConquerStructures.Broadcast.CurrentBroadcast.EntityName, System.Drawing.Color.Red, Network.GamePackets.Message.BroadcastMessage));
            client.Entity.Update(Network.GamePackets.Update.LuckyTimeTimer, client.BlessTime, false);
            if (client.Entity.HeavenBlessing != 0)
                client.Entity.Update(Network.GamePackets.Update.OnlineTraining, client.OnlineTrainingPoints, false);
            if (client.ClaimableItem.Count > 0)
                foreach (var item in client.ClaimableItem.Values)
                    item.Send(client);
            if (client.DeatinedItem.Count > 0)
                foreach (var item in client.DeatinedItem.Values)
                    item.Send(client);

            foreach (Interfaces.IConquerItem item in client.Inventory.Objects)
                item.Send(client);

            foreach (Interfaces.IConquerItem item in client.Equipment.Objects)
                if (item != null)
                {
                    if (Database.ConquerItemInformation.BaseInformations.ContainsKey(item.ID))
                    {
                        item.Send(client);
                        ItemUsage usage = new ItemUsage(true) { ID = ItemUsage.EquipItem };
                        usage.UID = item.UID;
                        usage.dwParam = item.Position;
                        client.Send(usage);
                        client.LoadItemStats(item);
                    }
                    else
                    {
                        client.Equipment.DestroyArrow(item.Position);
                        Console.WriteLine("Announcement: Item have been removed because of invalid info. UID: " + item.UID + ". OWNER: " + client.Entity.Name);
                    }
                }
            if (!client.Equipment.Free(5))
            {
                if (IsArrow(client.Equipment.TryGetItem(5).ID))
                {
                    if (client.Equipment.Free(4))
                        client.Equipment.DestroyArrow(5);
                    else
                    {
                        if (client.Equipment.TryGetItem(4).ID / 1000 != 500)
                            client.Equipment.DestroyArrow(5);
                    }
                }
            }
            client.GemAlgorithm();
            client.CalculateStatBonus();
            client.CalculateHPBonus();
            client.SendStatMessage();
            // Conquer_Online_Server.Game.Attacking.Calculate.Vitals(client.Entity, true);
            client.Equipment.UpdateEntityPacket();
            EntityEquipment equips = new EntityEquipment(true);
            equips.ParseHero(client);
            client.Send(equips);
            System.Threading.Thread.Sleep(3500);
            //if ((int)client.Account.State >= 3)
            //    client.Entity.AddFlag(Update.Flags.Flashy);
        }
开发者ID:faresali,项目名称:co-pserver,代码行数:101,代码来源:PacketHandler.cs

示例12: HandlePacket


//.........这里部分代码省略.........
                        if (AddStr > 0)
                        {
                            if (client.Entity.Atributes >= AddStr)
                            {
                                client.Entity.Atributes -= AddStr;
                                client.Entity.Strength += AddStr;
                            }
                        }
                        if (AddAgi > 0)
                        {
                            if (client.Entity.Atributes >= AddAgi)
                            {
                                client.Entity.Atributes -= AddAgi;
                                client.Entity.Agility += AddAgi;
                            }
                        }
                        if (AddVit > 0)
                        {
                            if (client.Entity.Atributes >= AddVit)
                            {
                                client.Entity.Atributes -= AddVit;
                                client.Entity.Vitality += AddVit;
                            }
                        }
                        if (AddSpi > 0)
                        {
                            if (client.Entity.Atributes >= AddSpi)
                            {
                                client.Entity.Atributes -= AddSpi;
                                client.Entity.Spirit += AddSpi;
                            }
                        }
                        //Conquer_Online_Server.Game.Attacking.Calculate.Vitals(client.Entity, true);
                        client.CalculateStatBonus();
                        client.CalculateHPBonus();
                        client.GemAlgorithm();
                        client.SendStatMessage();
                        break;
                    }
                #endregion
                #region Socketing (1027)
                case 1027:
                    {
                        EmbedSocket socket = new EmbedSocket(false);
                        socket.Deserialize(packet);
                        SocketItem(socket, client);
                        break;
                    }
                #endregion
                #region ItemAdding Stabilization
                case 1038:
                    {
                        ItemAddingStabilization stabilization = new ItemAddingStabilization(false);
                        stabilization.Deserialize(packet);
                        StabilazeArtifact(stabilization, client);
                        break;
                    }
                #endregion
                #region LoginPacket (1052)
                case 1052:
                    {
                        if (client.Action == 1)
                        {
                            Connect connect = new Connect();
                            connect.Deserialize(packet);
                            AppendConnect(connect, client);
开发者ID:faresali,项目名称:co-pserver,代码行数:67,代码来源:PacketHandler.cs

示例13: EquipItem


//.........这里部分代码省略.........
                                return;
                            }
                            else if (itemUsage.dwParam == 0 && ItemPosition(item.ID) == 0)
                            {
                                UseItem(item, client);
                                return;
                            }
                            break;
                        }
                }
                #region Sanity checks

                bool can2hand = false;
                bool can2wpn = false;
                if (client.Entity.Class >= 11 && client.Entity.Class <= 65)
                    can2hand = true;
                if (client.Entity.Class >= 11 && client.Entity.Class <= 15 || client.Entity.Class >= 51 && client.Entity.Class <= 55 || client.Entity.Class >= 61 && client.Entity.Class <= 65 || client.Entity.Class >= 71 && client.Entity.Class <= 75)
                    can2wpn = true;
                if (!Equipable(item, client))
                    return;
                if (ItemPosition(item.ID) == 5)
                {
                    itemUsage.dwParam = 5;
                    if (!can2hand && !can2wpn)
                        return;
                    if (client.Equipment.Free(4) || (client.Equipment.TryGetItem(4).ID / 1000 != 500 && IsArrow(item.ID)))
                        return;
                }
                if (ItemPosition(item.ID) == 4)
                {
                    if (itemUsage.dwParam == 5)
                        if (!can2hand || !can2wpn)
                            return;
                }
                if (!((itemUsage.dwParam == 4 || itemUsage.dwParam == 5) && (ItemPosition(item.ID) == 4 || ItemPosition(item.ID) == 5)))
                {
                    if (!IsAccessory(item.ID))
                        itemUsage.dwParam = ItemPosition(item.ID);
                }
                bool twohand = IsTwoHand(item.ID);
                if (!twohand && itemUsage.dwParam == 4)
                    if (!client.Equipment.Free(5))
                        if (client.Inventory.Count < 40)
                        {
                            if (IsArrow(client.Equipment.TryGetItem(5).ID))
                                client.Equipment.Remove(5);
                            else
                            {
                                if (client.Equipment.TryGetItem(4) != null)
                                {
                                    if (IsTwoHand(client.Equipment.TryGetItem(4).ID))
                                        client.Equipment.Remove(4);
                                }
                            }
                        }
                #endregion

                if (client.Map.ID == 1039)
                    client.Entity.AttackPacket = null;

                item.Position = (ushort)itemUsage.dwParam;
                if (ItemPosition(item.ID) == 5 && !IsArrow(item.ID))
                {
                    if (IsTwoHand(client.Equipment.TryGetItem(4).ID))
                    {
                        if (!client.Spells.ContainsKey(10311))//Perseverance
                        {
                            client.Send(new Message("You need to know Perseverance (Warrior Pure skill) to be able to wear 2-handed weapon and shield.", System.Drawing.Color.White, Message.Talk));
                            return;
                        }
                    }
                }

                Database.ConquerItemTable.ClearPosition(client.Entity.UID, (byte)itemUsage.dwParam);
                client.Inventory.Remove(item, Game.Enums.ItemUse.Move);
                if (client.Equipment.Free((byte)itemUsage.dwParam))
                {
                    if (twohand)
                        client.Equipment.Remove(5);
                    item.Position = (byte)itemUsage.dwParam;
                    client.Equipment.Add(item);
                    item.Mode = Game.Enums.ItemMode.Update;
                    item.Send(client);
                }
                else
                {
                    if (twohand)
                        client.Equipment.Remove(5);
                    client.Equipment.Remove((byte)itemUsage.dwParam);
                    item.Position = (byte)itemUsage.dwParam;
                    client.Equipment.Add(item);
                }
                client.CalculateStatBonus();
                client.CalculateHPBonus();
                client.SendStatMessage();
                EntityEquipment equips = new EntityEquipment(true);
                equips.ParseHero(client);
                client.Send(equips);
            }
        }
开发者ID:faresali,项目名称:co-pserver,代码行数:101,代码来源:PacketHandler.cs

示例14: CheckCommand


//.........这里部分代码省略.........
                                        x++)
                                    {
                                        if (x >= COunt) break;

                                        Client.GameState pClient = (varr.Current as Client.GameState);
                                        line += pClient.Entity.Name + ",";
                                        varr.MoveNext();

                                    }

                                    if (line.Length >= 255)
                                        return true;
                                    client.Send(new GamePackets.Message(line, System.Drawing.Color.Beige, GamePackets.Message.Talk));
                                    break;
                                }
                            case "reallot":
                                {
                                    if (client.Entity.Reborn != 0)
                                    {
                                        client.Entity.Agility = 0;
                                        client.Entity.Strength = 0;
                                        client.Entity.Vitality = 1;
                                        client.Entity.Spirit = 0;
                                        if (client.Entity.Reborn == 1)
                                        {
                                            client.Entity.Atributes = (ushort)(client.ExtraAtributePoints(client.Entity.FirstRebornLevel, client.Entity.FirstRebornLevel)
                                                + 52 + 3 * (client.Entity.Level - 15));
                                        }
                                        else
                                        {
                                            client.Entity.Atributes = (ushort)(client.ExtraAtributePoints(client.Entity.FirstRebornLevel, client.Entity.FirstRebornClass) +
                                                client.ExtraAtributePoints(client.Entity.SecondRebornLevel, client.Entity.SecondRebornClass) + 52 + 3 * (client.Entity.Level - 15));
                                        }
                                        client.CalculateStatBonus();
                                        client.CalculateHPBonus();
                                    }
                                    break;
                                }
                            case "str":
                                {
                                    ushort atr = 0;
                                    ushort.TryParse(Data[1], out atr);
                                    if (client.Entity.Atributes >= atr)
                                    {
                                        client.Entity.Strength += atr;
                                        client.Entity.Atributes -= atr;
                                        client.CalculateStatBonus();
                                        client.CalculateHPBonus();
                                    }
                                    break;
                                }
                            case "agi":
                                {
                                    ushort atr = 0;
                                    ushort.TryParse(Data[1], out atr);
                                    if (client.Entity.Atributes >= atr)
                                    {
                                        client.Entity.Agility += atr;
                                        client.Entity.Atributes -= atr;
                                        client.CalculateStatBonus();
                                        client.CalculateHPBonus();
                                    }
                                    break;
                                }
                            case "vit":
                                {
开发者ID:faresali,项目名称:co-pserver,代码行数:67,代码来源:PacketHandler.cs

示例15: UnequipItem

 static void UnequipItem(ItemUsage usage, Client.GameState client)
 {
     if (client.Equipment.Remove((byte)usage.dwParam))
     {
         if (client.Map.ID == 1039)
             client.Entity.AttackPacket = null;
         client.CalculateStatBonus();
         client.CalculateHPBonus();
         client.SendStatMessage();
         EntityEquipment equips = new EntityEquipment(true);
         equips.ParseHero(client);
         client.Send(equips);
     }
 }
开发者ID:faresali,项目名称:co-pserver,代码行数:14,代码来源:PacketHandler.cs


注:本文中的Client.CalculateStatBonus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。