Exemplo n.º 1
0
        public void HandleEvent(Objective_Type Type, uint Entry, int Count, bool Group = false)
        {
            if (!Group && _Owner.IsPlayer() && _Owner.GetPlayer().GetGroup() != null)
            {
                Group Current = _Owner.GetPlayer().GetGroup();

                lock (Current.Members)
                {
                    foreach (Player SubPlayer in Current.Members)
                    {
                        if (SubPlayer != _Owner && SubPlayer.GetDistance(_Owner) < 150)
                        {
                            SubPlayer.QtsInterface.HandleEvent(Type, Entry, Count, true);
                        }
                    }
                }
            }

            //if (_Owner.IsPet())
            //if (_Owner.GetPet().Owner != null)
            // _Owner.GetPet().Owner.QtsInterface.HandleEvent(Type, Entry, Count, true);



            foreach (KeyValuePair <ushort, Character_quest> QuestKp in _Quests)
            {
                foreach (Character_Objectives Objective in QuestKp.Value._Objectives)
                {
                    if (Objective.Objective == null)
                    {
                        continue;
                    }

                    if (Objective.Objective.ObjType == (uint)Type && !Objective.IsDone())
                    {
                        bool CanAdd   = false;
                        int  NewCount = Objective.Count;

                        if (Type == Objective_Type.QUEST_SPEACK_TO || Type == Objective_Type.QUEST_KILL_MOB || Type == Objective_Type.QUEST_PROTECT_UNIT)
                        {
                            if (Objective.Objective.Creature != null && Entry == Objective.Objective.Creature.Entry)
                            {
                                CanAdd    = true;
                                NewCount += Count;
                            }
                        }
                        else if (Type == Objective_Type.QUEST_GET_ITEM)
                        {
                            if (Objective.Objective.Item != null && Entry == Objective.Objective.Item.Entry)
                            {
                                CanAdd   = true;
                                NewCount = _Owner.GetPlayer().ItmInterface.GetItemCount(Entry);
                            }
                        }
                        else if (Type == Objective_Type.QUEST_USE_GO)
                        {
                            if (Objective.Objective.GameObject != null && Entry == Objective.Objective.GameObject.Entry)
                            {
                                CanAdd    = true;
                                NewCount += Count;
                            }
                        }
                        else if (Type == Objective_Type.QUEST_UNKNOWN)
                        {
                            if (Objective.Objective.Guid == Entry)
                            {
                                CanAdd    = true;
                                NewCount += Count;
                            }
                        }

                        if (CanAdd)
                        {
                            Objective.Count     = NewCount;
                            QuestKp.Value.Dirty = true;
                            SendQuestUpdate(QuestKp.Value);
                            CharMgr.Database.SaveObject(QuestKp.Value);

                            if (Objective.IsDone())
                            {
                                Creature Finisher;

                                foreach (Object Obj in _Owner._ObjectRanged)
                                {
                                    if (Obj.IsCreature())
                                    {
                                        Finisher = Obj.GetCreature();
                                        if (WorldMgr.HasQuestToFinish(Finisher.Entry, QuestKp.Value.Quest.Entry))
                                        {
                                            Finisher.SendMeTo(_Owner.GetPlayer());
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
 public bool AcceptQuest(UInt16 QuestID)
 {
     return(AcceptQuest(WorldMgr.GetQuest(QuestID)));
 }
Exemplo n.º 3
0
        public override void SendInteract(Player Plr, InteractMenu Menu)
        {
            Log.Success("SendInteract", "" + Name + " -> " + Plr.Name + ",Type=" + InteractType);

            Plr.QtsInterface.HandleEvent(Objective_Type.QUEST_SPEACK_TO, Spawn.Entry, 1);

            if (!IsDead)
            {
                switch (InteractType)
                {
                case GameData.InteractType.INTERACTTYPE_DYEMERCHANT:
                {
                    string Text = WorldMgr.GetCreatureText(Spawn.Entry);

                    if (Menu.Menu == 9)         // List des objets a vendre
                    {
                        WorldMgr.SendVendor(Plr, Spawn.Entry);
                    }
                    else if (Menu.Menu == 11)         // Achat d'un item
                    {
                        WorldMgr.BuyItemVendor(Plr, Menu, Spawn.Entry);
                    }
                    else if (Menu.Menu == 14)         // Vend un Item
                    {
                        Plr.ItmInterface.SellItem(Menu);
                    }
                    else if (Menu.Menu == 36)         // Rachette un item
                    {
                        Plr.ItmInterface.BuyBackItem(Menu);
                    }
                    else
                    {
                        PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                        Out.WriteByte(0);
                        Out.WriteUInt16(Oid);
                        Out.WriteUInt16(0);
                        Out.WriteByte(0x40);         // Dye
                        Out.WriteByte(0x22);         // Vendors
                        Out.WriteByte(0);
                        Out.WritePascalString(Text);
                        Out.WriteByte(0);
                        Plr.SendPacket(Out);
                    }
                } break;

                case GameData.InteractType.INTERACTTYPE_FLIGHT_MASTER:
                {
                    byte[] data = new byte[62]
                    {
                        0x01, 0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x42, 0x39, 0x00, 0x00, 0x00, 0xC0, 0xE3,
                        0x03, 0x39, 0xA0, 0xD1, 0x6F, 0x00, 0xC8, 0xA8, 0x1D, 0x37, 0x28, 0x94, 0x79, 0x33, 0xB2, 0x24,
                        0x32, 0x44, 0xDB, 0xD7, 0x1C, 0x5D, 0x18, 0x5D, 0xDD, 0x1C, 0xA4, 0x0D, 0x00, 0x00, 0xA8, 0x6B,
                        0x21, 0x36, 0x11, 0x00, 0x00, 0x00, 0xC8, 0xD0, 0xAF, 0x3A, 0x78, 0xD1, 0x6F, 0x00
                    };

                    UInt16    Counts = 1;
                    Zone_Info Info;

                    PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                    Out.WriteUInt16(0x0A12);
                    foreach (Zone_Taxi Taxi in WorldMgr.GetTaxis(Plr))
                    {
                        Out.WriteUInt16(Counts);
                        Out.WriteByte(2);
                        Out.WriteUInt16(Taxi.Info.Price);
                        Out.WriteUInt16(Taxi.Info.ZoneId);
                        Out.WriteByte(1);
                        ++Counts;
                    }
                    Out.Write(data);
                    Plr.SendPacket(Out);
                } break;

                default:
                    QtsInterface.HandleInteract(Plr, Menu);
                    break;
                }
                ;
            }

            base.SendInteract(Plr, Menu);
        }
Exemplo n.º 4
0
        public void BuildInteract(Player Plr, Creature Crea, PacketOut Out)
        {
            List <Quest> Starter    = Crea.Spawn.Proto.StartingQuests;
            List <Quest> Finisher   = Crea.Spawn.Proto.FinishingQuests;
            List <Quest> InProgress = Starter != null?Starter.FindAll(info => Plr.QtsInterface.HasQuest(info.Entry) && !Plr.QtsInterface.HasDoneQuest(info.Entry)) : null;

            string Text = WorldMgr.GetCreatureText(Entry);


            //////////////////////////////////////////////////////////////////////////////////////////////
            //if (Starter == null && Finisher == null && Text.Length <= 0 && InProgress == null)//added
            //return;// added
            ////////////////////////////////////////////////////////////////////////////////////////////////

            // was disabled ???
            //PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
            //Out.WriteByte(0);
            //Out.WriteUInt16(Obj.Oid);
            //Out.WriteUInt16(_Owner.Oid);
            //Out.Fill(0, 3);
            //Out.WriteByte(0x60);
            /////////////////////////////////////////////

            Out.WriteUInt32(0);
            Out.WriteUInt16(Plr.Oid);

            if (Starter != null)
            {
                List <Quest> Starts = Starter.FindAll(q => Plr.QtsInterface.CanStartQuest(q));

                //Log.Success("QuestInterface", "Handle Interact : Starts=" + Starts.Count);

                Out.WriteByte((byte)Starts.Count);
                foreach (Quest Q in Starts)
                {
                    Out.WriteByte(0);
                    Out.WriteUInt16(Q.Entry);
                    Out.WriteUInt16(0);
                    Out.WritePascalString(Q.Name);
                }
            }
            else
            {
                Out.WriteByte(0);
            }

            if (Finisher != null)
            {
                List <Quest> Finishs = Finisher.FindAll(q => Plr.QtsInterface.CanEndQuest(q));

                //Log.Success("QuestInterface", "Handle Interact : Finishs=" + Finishs.Count);

                Out.WriteByte((byte)Finishs.Count);
                foreach (Quest Q in Finishs)
                {
                    Out.WriteByte(0);
                    Out.WriteUInt16(Q.Entry);
                    Out.WritePascalString(Q.Name);
                }
            }
            else if (InProgress != null)
            {
                // Log.Success("QuestInterface", "Handle Interact : InProgress=" + InProgress.Count);

                Out.WriteByte((byte)InProgress.Count);
                foreach (Quest Q in InProgress)
                {
                    Out.WriteByte(0);
                    Out.WriteUInt16(Q.Entry);
                    Out.WritePascalString(Q.Name);
                }
            }
            else
            {
                Out.WriteByte(0);
            }


            //Log.Info("QTS", "Text=" + Text);

            Out.WriteUInt16((ushort)Text.Length);
            Out.WriteStringBytes(Text);
            Out.WriteByte(0);

            Plr.SendPacket(Out);
        }
Exemplo n.º 5
0
        public ItemError CreateItem(UInt32 ItemId, UInt16 Count)
        {
            Item_Info Info = WorldMgr.GetItem_Info(ItemId);

            return(CreateItem(Info, Count));
        }
Exemplo n.º 6
0
 public void LoadSpawns()
 {
     _CellSpawns = WorldMgr.GetCells(RegionId);
 }
Exemplo n.º 7
0
        public override void SendInteract(Player Plr, InteractMenu Menu)
        {
            Log.Success("SendInteract", "" + Name + " -> " + Plr.Name + ",Type=" + InteractType);



            Plr.QtsInterface.HandleEvent(Objective_Type.QUEST_SPEACK_TO, Spawn.Entry, 1);

            if (!IsDead)
            {
                // perhaps do some checks?
                if (Menu.Menu == 7) // Trainer Spells
                {
                    PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                    Out.WriteByte(5);
                    Out.WriteByte(0x0F);
                    Out.WriteByte(6);
                    Out.WriteUInt16(0);
                    Plr.SendPacket(Out);
                }
                else if (Menu.Menu == 9) // List items for sale
                {
                    WorldMgr.SendVendor(Plr, Spawn.Entry);
                }
                else if (Menu.Menu == 11) // Buy an item
                {
                    WorldMgr.BuyItemVendor(Plr, Menu, Spawn.Entry);
                }
                else if (Menu.Menu == 14) // Sells an Item
                {
                    Plr.ItmInterface.SellItem(Menu);
                }
                else if (Menu.Menu == 25) // Set rally point
                {
                    RallyPoint Rally = WorldMgr.GetRallyPointFromNPC(Entry);
                    if (Rally != null)
                    {
                        Plr._Value.RallyPoint = Rally.Id;

                        PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                        Out.WriteByte(0x12);
                        Out.WriteUInt16(Menu.Oid);
                        Out.WriteUInt16(Plr._Value.RallyPoint);
                        Plr.SendPacket(Out);
                    }
                    else
                    {
                        Plr.SendLocalizeString("ERROR: Unknown Rally Point NPC (" + Entry + ").", GameData.Localized_text.CHAT_TAG_DEFAULT);
                    }
                }
                else if (Menu.Menu == 36) // Buy back item
                {
                    Plr.ItmInterface.BuyBackItem(Menu);
                }
                else if (Menu.Menu == 37) // Dye menu
                {
                    byte MAX_DYES = 30;

                    PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                    Out.WriteByte(0x1B);

                    List <Dye_Info> Dyes  = WorldMgr.GetDyes();
                    byte            count = (byte)Math.Min(Dyes.Count, MAX_DYES);

                    Out.WriteByte(count);
                    for (byte i = 0; i < count; i++)
                    {
                        Out.WriteByte(i);
                        Out.WriteUInt16(Dyes[i].Entry);
                        Out.WriteUInt32(Dyes[i].Price);
                    }

                    Plr.SendPacket(Out);
                }
                else if (Menu.Menu == 38) // Dye one item
                {
                    Item item = Plr.ItmInterface.GetItemInSlot(Menu.Num);

                    if (item == null)
                    {
                        return;
                    }

                    byte   PrimaryDye     = Menu.Packet.GetUint8();
                    byte   SecondaryDye   = Menu.Packet.GetUint8();
                    ushort PrimaryDyeId   = 0;
                    ushort SecondaryDyeId = 0;

                    uint cost = 0;
                    // 255 = no dye selected
                    if (PrimaryDye != 255)
                    {
                        cost += WorldMgr.GetDyes()[PrimaryDye].Price;
                    }

                    // 255 = no dye selected
                    if (SecondaryDye != 255)
                    {
                        cost += WorldMgr.GetDyes()[SecondaryDye].Price;
                    }

                    if (!Plr.RemoveMoney(cost))
                    {
                        Plr.SendLocalizeString("", GameData.Localized_text.TEXT_AUCTION_NOT_ENOUGH_MONEY);
                        return;
                    }

                    // 255 = no dye selected
                    if (PrimaryDye != 255)
                    {
                        PrimaryDyeId = WorldMgr.GetDyes()[PrimaryDye].Entry;
                    }

                    // 255 = no dye selected
                    if (SecondaryDye != 255)
                    {
                        SecondaryDyeId = WorldMgr.GetDyes()[SecondaryDye].Entry;
                    }

                    Plr.ItmInterface.DyeItem(item, PrimaryDyeId, SecondaryDyeId);

                    if (Plr._IsActive && Plr.IsInWorld() && Plr._Loaded)
                    {
                        foreach (Player P in _PlayerRanged)
                        {
                            if (P.HasInRange(Plr))
                            {
                                Plr.ItmInterface.SendEquiped(P);
                            }
                        }
                    }
                }
                else if (Menu.Menu == 39) // Dye all items
                {
                    byte Count = 0;
                    for (UInt16 i = 0; i < ItemsInterface.MAX_EQUIPED_SLOT; ++i)
                    {
                        if (Plr.ItmInterface.Items[i] != null) // && is dyable
                        {
                            ++Count;
                        }
                    }

                    byte   PrimaryDye     = Menu.Packet.GetUint8();
                    byte   SecondaryDye   = Menu.Packet.GetUint8();
                    ushort PrimaryDyeId   = 0;
                    ushort SecondaryDyeId = 0;

                    uint cost = 0;
                    // 255 = no dye selected
                    if (PrimaryDye != 255)
                    {
                        cost += WorldMgr.GetDyes()[PrimaryDye].Price * Count;
                    }

                    // 255 = no dye selected
                    if (SecondaryDye != 255)
                    {
                        cost += WorldMgr.GetDyes()[SecondaryDye].Price * Count;
                    }

                    if (!Plr.RemoveMoney(cost))
                    {
                        Plr.SendLocalizeString("", GameData.Localized_text.TEXT_AUCTION_NOT_ENOUGH_MONEY);
                        return;
                    }

                    // 255 = no dye selected
                    if (PrimaryDye != 255)
                    {
                        PrimaryDyeId = WorldMgr.GetDyes()[PrimaryDye].Entry;
                    }

                    // 255 = no dye selected
                    if (SecondaryDye != 255)
                    {
                        SecondaryDyeId = WorldMgr.GetDyes()[SecondaryDye].Entry;
                    }

                    for (UInt16 i = 0; i < ItemsInterface.MAX_EQUIPED_SLOT; ++i)
                    {
                        if (Plr.ItmInterface.Items[i] != null) // && is dyable
                        {
                            Plr.ItmInterface.DyeItem(Plr.ItmInterface.Items[i], PrimaryDyeId, SecondaryDyeId);
                        }
                    }

                    if (Plr._IsActive && Plr.IsInWorld() && Plr._Loaded)
                    {
                        foreach (Player P in _PlayerRanged)
                        {
                            if (P.HasInRange(Plr))
                            {
                                Plr.ItmInterface.SendEquiped(P);
                            }
                        }
                    }
                }
                else
                {
                    switch (InteractType)
                    {
                    case GameData.InteractType.INTERACTTYPE_FLIGHT_MASTER:
                    {
                        byte[] data = new byte[62]
                        {
                            0x01, 0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x42, 0x39, 0x00, 0x00, 0x00, 0xC0, 0xE3,
                            0x03, 0x39, 0xA0, 0xD1, 0x6F, 0x00, 0xC8, 0xA8, 0x1D, 0x37, 0x28, 0x94, 0x79, 0x33, 0xB2, 0x24,
                            0x32, 0x44, 0xDB, 0xD7, 0x1C, 0x5D, 0x18, 0x5D, 0xDD, 0x1C, 0xA4, 0x0D, 0x00, 0x00, 0xA8, 0x6B,
                            0x21, 0x36, 0x11, 0x00, 0x00, 0x00, 0xC8, 0xD0, 0xAF, 0x3A, 0x78, 0xD1, 0x6F, 0x00
                        };

                        UInt16 Counts = 1;

                        PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                        Out.WriteByte(0x0A);
                        List <Zone_Taxi> Taxis = WorldMgr.GetTaxis(Plr);
                        Out.WriteByte((byte)Taxis.Count);
                        foreach (Zone_Taxi Taxi in Taxis)
                        {
                            Out.WriteUInt16(Counts);
                            Out.WriteByte((byte)Taxi.Info.Pairing);
                            Out.WriteUInt16(Taxi.Info.Price);
                            Out.WriteUInt16(Taxi.Info.ZoneId);
                            Out.WriteByte(1);
                            ++Counts;
                        }
                        Out.Write(data);
                        Plr.SendPacket(Out);
                    } break;

                    case GameData.InteractType.INTERACTTYPE_BANKER:
                    {
                        PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                        Out.WriteByte(0x1D);
                        Out.WriteByte(0);        // need to find bank buy box



                        /*
                         * Out = new PacketOut((byte)Opcodes.F_BAG_INFO);
                         * Out.WriteByte(0x0F);
                         * Out.WriteByte(ItmInterface.GetTotalSlot()); // Number of available slots  // GetTotalSlot
                         * Out.WriteUInt16((UInt16)ItemsInterface.INVENTORY_SLOT_COUNT);
                         * Out.WriteByte(0);
                         * Out.WriteUInt32R(ItmInterface.GetBagPrice());//GetBagPrice
                         *
                         * Out.WriteUInt16(2);// was 2
                         * Out.WriteByte(0x50);// was 0x50
                         * Out.WriteUInt16(0x08);// 0x08
                         * Out.WriteUInt16(0x60);// 0x60
                         * Out.WriteByte(0xEA);// 0xEA
                         * Out.WriteUInt16(0);
                         */



                        Plr.SendPacket(Out);
                    } break;


                    case GameData.InteractType.INTERACTTYPE_SIEGEWEAP:
                    {
                        //     /*
                        PacketOut Out = new PacketOut((byte)Opcodes.F_UPDATE_STATE);

                        Out.WriteUInt16(Oid);
                        Out.WriteByte(0x1D);
                        Out.WriteByte(1);
                        Out.WriteByte(1);
                        Out.WriteByte(2);
                        Out.WriteUInt16(0);
                        Out.WriteByte(0x02);
                        Out.WriteByte(0x4A);
                        Out.WriteUInt16(0);
                        Plr.SendPacket(Out);
                        //21 D9 1D 01 01 02 00 00 02 4A 00 00



                        Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                        Out.WriteByte(0x18);
                        Out.WriteByte(1);
                        Out.WriteUInt16(0x005C);
                        Out.WritePascalString(Name);
                        Out.WriteByte(1);
                        Out.WriteByte(0x3F);
                        Out.WriteUInt16(0);
                        Out.WriteByte(0x0E);
                        //Out.WriteByte(0xA6);//(byte)Zone.ZoneId);//zone
                        Out.WriteHexStringBytes("A6103C000400011E0000000002");
                        Out.WriteByte(0);        // reload?
                        Out.WriteUInt16(0x0B);
                        Out.WriteByte(0);


                        //  Out.WriteHexStringBytes("1801005C0D456D706972652043616E6E6F6E013F00000EA6103C000400011E000000000200000B00");

                        Plr.SendPacket(Out);



                        Out = new PacketOut((byte)Opcodes.F_UPDATE_STATE);
                        Out.WriteUInt16(Oid);
                        Out.WriteByte(0x21);
                        Out.WriteByte(0x3C);        // 3c=60 seconds 6000 14=20 seconds=2000
                        Out.Fill(0, 6);
                        Plr.SendPacket(Out);



                        Out = new PacketOut((byte)Opcodes.F_UPDATE_STATE);
                        Out.WriteUInt16(Oid);
                        Out.WriteByte(0x1C);
                        Out.WriteByte(0x3);        //14=20 seconds=2000
                        //Out.Fill(0, 6);
                        Plr.SendPacket(Out);


                        // 1D 01 01 02 00 00 8A DF 00 00

                        Out = new PacketOut((byte)Opcodes.F_UPDATE_STATE);
                        Out.WriteUInt16(Oid);
                        Out.WriteByte(0x1D);
                        Out.WriteByte(1);
                        Out.WriteByte(1);
                        Out.WriteByte(2);
                        Out.WriteUInt16(0);
                        Out.WriteByte(0x8A);
                        Out.WriteByte(0xDF);
                        Out.WriteUInt16(0);
                        Plr.SendPacket(Out);


                        //                          */



                        /*
                         *
                         *  // controll timer // size 13
                         *   Out = new PacketOut((byte)Opcodes.F_UPDATE_STATE);
                         *   Out.WriteUInt16(Oid);
                         *   Out.WriteByte(0x21);
                         *   Out.WriteByte(0x3C);// 3c=60 seconds 6000 14=20 seconds=2000
                         *   Out.Fill(0, 6);
                         *  Plr.SendPacket(Out);
                         *
                         *  // size 7
                         *  Out = new PacketOut((byte)Opcodes.F_UPDATE_STATE);
                         *  Out.WriteUInt16(Oid);
                         *  Out.WriteByte(0x1C);
                         *  Out.WriteByte(0x3);//14=20 seconds=2000
                         *  //Out.Fill(0, 6);
                         *  Plr.SendPacket(Out);
                         *
                         *
                         *
                         */



                        /*
                         * //size 15
                         * Out = new PacketOut((byte)Opcodes.F_UPDATE_STATE);
                         * Out.WriteUInt16(Oid);
                         * Out.WriteByte(0x1D);
                         * Out.WriteByte(1);
                         * Out.WriteByte(1);
                         * Out.WriteByte(2);
                         * Out.WriteUInt16(0);
                         * Out.WriteByte(2);
                         * Out.WriteByte(0x4A);
                         * Out.WriteUInt16(0);
                         *
                         * //  Out.WriteByte(0x3);//14=20 seconds=2000
                         * //Out.Fill(0, 6);
                         * Plr.SendPacket(Out);
                         */



                        /*
                         * // target icon
                         * Out = new PacketOut((byte)Opcodes.F_UPDATE_STATE);
                         * Out.WriteUInt16(Oid);
                         * Out.WriteByte(0x1C);
                         * Out.WriteByte(0x3);//14=20 seconds=2000
                         * Out.Fill(0, 6);
                         * Plr.SendPacket(Out);
                         * // */
                    } break;



                    case GameData.InteractType.INTERACTTYPE_GUILD_VAULT:
                    {
                        //Size = 43
                        // opens guild vault 5 slots
                        PacketOut Out = new PacketOut((byte)Opcodes.F_GUILD_DATA);
                        Out.WriteByte(0x18);     // ??
                        //Out.WriteByte(0x1);// this shows a buy box
                        Out.WriteByte(5);        // number of vault boxs  0 to 5
                        Out.Fill(0, 8);

                        // VAULT BOX 1
                        Out.WriteUInt16(0x003C);
                        //Out.WriteByte(0x3C);
                        Out.Fill(0, 4);

                        // VAULT BOX 2
                        Out.WriteUInt16(0x003C);
                        //Out.WriteByte(0x3C);
                        Out.Fill(0, 4);

                        // VAULT BOX 3
                        Out.WriteUInt16(0x003C);
                        //Out.WriteByte(0x3C);
                        Out.Fill(0, 4);

                        // VAULT BOX 4
                        Out.WriteUInt16(0x003C);
                        //Out.WriteByte(0x3C);
                        Out.Fill(0, 4);

                        // VAULT BOX 5
                        Out.WriteUInt16(0x003C);
                        //Out.WriteByte(0x3C);
                        Out.Fill(0, 4);

                        Plr.SendPacket(Out);
                    } break;



                    //Heal Penalties structure i added
                    case GameData.InteractType.INTERACTTYPE_HEALER:
                    {          // packet size 9  -3=6
                        PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                        Out.WriteByte(0x13);
                        Out.WriteByte(1);        // this the penalty points u have
                        Out.WriteUInt16(0);
                        // Out.WriteByte(0);// gold ?
                        //Out.WriteByte(0);// gold
                        Out.WriteByte(1);        //1 silver
                        Out.WriteByte(0);        // 90??// brass
                        Plr.SendPacket(Out);

                        // this packet heals size 6 -3 =3 size
                        Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                        Out.WriteByte(0x14);
                        Out.WriteByte(1);        // this the penalty points u have
                        Out.WriteByte(90);       // 90??// brass
                        Plr.SendPacket(Out);
                    } break;

                    //10 00 03 2E 49 01 00 00 00 00
                    case GameData.InteractType.INTERACTTYPE_BARBERSHOP:
                    {          // packet size 13 -3=10
                        PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                        Out.WriteByte(0x10);
                        Out.WriteByte(0);
                        Out.WriteByte(3);        // 3
                        Out.WriteByte(0x2E);     //2E
                        Out.WriteByte(0x49);     //49
                        Out.WriteByte(1);        // 1 // this is tokens that is required if set to 5 it says=(you dont have enough tokens in your inventory 5 token are required
                        Out.WriteUInt32(0);
                        Plr.SendPacket(Out);
                    } break;

                    //0E 01 01 00
                    case GameData.InteractType.INTERACTTYPE_GUILD_REGISTRAR:
                    {
                        // packet size 13 -3=10
                        PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                        Out.WriteByte(0x0E);
                        Out.WriteByte(1);        //0= sucess full /1=
                        Out.WriteByte(1);        //0= sucess full /1=
                        Out.WriteByte(0);        //
                        Plr.SendPacket(Out);
                    } break;


                    case GameData.InteractType.INTERACTTYPE_AUCTIONEER:    //INTERACTTYPE_AUCTIONEER = 13,
                    {
                        PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                        Out.WriteByte(0x1A);
                        Out.WriteByte(0);
                        Plr.SendPacket(Out);


                        Out = new PacketOut((byte)Opcodes.F_AUCTION_SEARCH_RESULT);
                        Out.WritePacketString(@"|00 00 9E 22 00 01 01 00 00 00 00 00 71 |..............q|
|67 F1 00 01 82 52 00 00 00 00 00 00 27 10 03 43 |g....R......'..C|
|68 6F 73 73 65 74 74 65 5E 4D 00 00 00 00 00 00 |hossette^M......|
|00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
|00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF |................|
|5F 39 00 00 01 4B B6 0F 30 00 00 00 00 00 00 00 |_9...K..0.......|
|00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 |................|
|00 00 00 00 00 00 06 00 14 00 14 00 00 00 00 00 |................|
|00 00 00 00 00 00 00 10 57 69 6C 74 65 64 20 57 |........Wilted W|
|69 6C 64 20 57 65 65 64 00 00 00 06 08 00 05 07 |ild Weed........|
|00 04 01 00 00 02 00 00 04 00 00 0F 00 01 00 00 |................|
|00 00 01 00 00 03 02 00 08 00 00 00 00 00 00 00 |................|
|00 00 00 00 00 00 00 00 00 00 00 00 00          |.............   |");
                        Plr.DispatchPacket(Out, true);


                        //  Out = new PacketOut((byte)Opcodes.F_AUCTION_BID_STATUS);
                    } break;

                    /////////added////////////////////////////////////////////////////////////////////////////////////////
                    // case GameData.InteractType.INTERACTTYPE_SIEGEWEAP:
                    //  {
                    //   PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                    //  Out.WriteByte(0x1A);
                    //  Out.WriteByte(0);
                    //  Plr.SendPacket(Out);
                    //  } break;
                    default:
                    {
                        ushort MenuItems = 0;
                        string Text      = WorldMgr.GetCreatureText(Spawn.Entry);

                        if (InteractType == GameData.InteractType.INTERACTTYPE_DYEMERCHANT)
                        {
                            MenuItems += 2;         // Shop // 2
                            MenuItems += 16384;     // Dyes

                            // You need Text to see the 'dyes' option
                            if (Text == String.Empty)
                            {
                                Text = "Selling a bit of everything here, come on have a look see!";
                            }


                            //Text = "Forget about the drut he's selling; take a look at these beauties!"; ORIGNAL IN DB


                            //Text = "Come and see what I have.";
                        }

                        bool HasQuests = QtsInterface.HasQuestInteract(Plr, this);
                        if (HasQuests)
                        {
                            MenuItems += 64;         // Quests
                        }
                        if (InteractType == GameData.InteractType.INTERACTTYPE_GUILD_REGISTRAR)
                        {
                            MenuItems += 128;         // Guild Register =128
                            // Guild Regiser needs text
                            if (Text == String.Empty)
                            {
                                Text = "Let's get started. To form a guild, you'll need to have a full group of six adventurers with you. None of you can belong to another guild. For a modest fee of only fifty silver I can create your guild.";
                            }
                        }


                        if (InteractType == GameData.InteractType.INTERACTTYPE_TRAINER)
                        {
                            MenuItems += 1;         // Trainer =1
                            // Theese were previously in there, nice to keep them unless theres info in creature_texts
                            if (Text == String.Empty)
                            {
                                if (Plr.Realm == GameData.Realms.REALMS_REALM_ORDER)
                                {
                                    Text = "Hail defender of the Empire!  Your performance in battle is the only thing that keeps the hordes of Chaos at bay. Let's begin your training at once!";
                                }


                                else
                                {
                                    Text = "Learn these lessons well, for gaining the favor of the Raven god should be of utmost importance to you. Otherwise... There is always room for more Spawn within our ranks.";
                                }
                            }
                        }

                        if (InteractType == GameData.InteractType.INTERACTTYPE_BINDER)
                        {
                            MenuItems += 228;         // Rally Point =256/ 228 is rally quest+influnce
                        }
                        if (Text.Length > 0)
                        {
                            MenuItems += 32;         // Text
                        }
                        // VENDORS INVENTERY BOX PACKET
                        PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);

                        Log.Info("Creature", "npc = " + Name + "  Oid = " + Oid + " MenuItems = " + MenuItems + "  X= " + Spawn.WorldX + "  Y= " + Spawn.WorldY + "  Z= " + Spawn.WorldZ);
                        Out.WriteByte(0);
                        Out.WriteUInt16(Menu.Oid);
                        Out.WriteUInt16(0);
                        Out.WriteUInt16(MenuItems);
                        if (HasQuests)
                        {
                            QtsInterface.BuildInteract(Plr, this, Out);
                        }
                        if (Text.Length > 0)
                        {
                            Out.WriteByte(0);       // added and fixed the dye screen error, was missing this byte now working whoohooo
                        }
                        Out.WriteShortString(Text); // need to fix this ??
                        //Out.WritePascalString(Text);// added this because above gives error
                        Out.WriteByte(0);           // added this is on live server mite not need this byte
                        Plr.SendPacket(Out);
                    } break;
                    }
                }
            }
            base.SendInteract(Plr, Menu);
        }
Exemplo n.º 8
0
        public override void SendInteract(Player Plr, InteractMenu Menu)
        {
            Plr.QtsInterface.HandleEvent(Objective_Type.QUEST_SPEACK_TO, Spawn.Entry, 1);

            if (!IsDead)
            {
                switch (InteractType)
                {
                case GameData.InteractType.INTERACTTYPE_DYEMERCHANT:
                {
                    string Text = WorldMgr.GetCreatureText(Spawn.Entry);

                    if (Menu.Menu == 9)         // List des objets a vendre
                    {
                        WorldMgr.SendVendor(Plr, Spawn.Entry);
                    }
                    else if (Menu.Menu == 11)         // Achat d'un item
                    {
                        WorldMgr.BuyItemVendor(Plr, Menu, Spawn.Entry);
                    }
                    else if (Menu.Menu == 14)         // Vend un Item
                    {
                        Plr.ItmInterface.SellItem(Menu);
                    }
                    else if (Menu.Menu == 36)         // Rachette un item
                    {
                        Plr.ItmInterface.BuyBackItem(Menu);
                    }
                    else
                    {
                        PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                        Out.WriteByte(0);
                        Out.WriteUInt16(Oid);
                        Out.WriteUInt16(0);
                        Out.WriteByte(0x40);         // Dye
                        Out.WriteByte(0x22);         // Vendors
                        Out.WriteByte(0);
                        Out.WritePascalString(Text);
                        Out.WriteByte(0);
                        Plr.SendPacket(Out);
                    }
                } break;

                case GameData.InteractType.INTERACTTYPE_FLIGHT_MASTER:
                {
                    byte[] data = new byte[62]
                    {
                        0x01, 0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x42, 0x39, 0x00, 0x00, 0x00, 0xC0, 0xE3,
                        0x03, 0x39, 0xA0, 0xD1, 0x6F, 0x00, 0xC8, 0xA8, 0x1D, 0x37, 0x28, 0x94, 0x79, 0x33, 0xB2, 0x24,
                        0x32, 0x44, 0xDB, 0xD7, 0x1C, 0x5D, 0x18, 0x5D, 0xDD, 0x1C, 0xA4, 0x0D, 0x00, 0x00, 0xA8, 0x6B,
                        0x21, 0x36, 0x11, 0x00, 0x00, 0x00, 0xC8, 0xD0, 0xAF, 0x3A, 0x78, 0xD1, 0x6F, 0x00
                    };

                    UInt16 Counts = 1;

                    PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                    Out.WriteUInt16(0x0A12);
                    foreach (Zone_Taxi Taxi in WorldMgr.GetTaxis(Plr))
                    {
                        Out.WriteUInt16(Counts);
                        Out.WriteByte(2);
                        Out.WriteUInt16(Taxi.Info.Price);
                        Out.WriteUInt16(Taxi.Info.ZoneId);
                        Out.WriteByte(1);
                        ++Counts;
                    }
                    Out.Write(data);
                    Plr.SendPacket(Out);
                } break;

                case GameData.InteractType.INTERACTTYPE_TRAINER:
                {
                    if (Menu.Menu == 7)
                    {
                        PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                        Out.WriteByte(5);
                        Out.WriteByte(0x0F);
                        Out.WriteByte(6);
                        Out.WriteUInt16(0);
                        Plr.SendPacket(Out);
                    }
                    else
                    {
                        PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                        Out.WriteByte(0);
                        Out.WriteUInt16(Oid);

                        if (Plr.Realm == GameData.Realms.REALMS_REALM_ORDER)
                        {
                            Out.WritePacketString(@"|00 00 00 21 00 94 48 61 69 6C |.........!..Hail|
|20 64 65 66 65 6E 64 65 72 20 6F 66 20 74 68 65 | defender of the|
|20 45 6D 70 69 72 65 21 20 20 59 6F 75 72 20 70 | Empire!  Your p|
|65 72 66 6F 72 6D 61 6E 63 65 20 69 6E 20 62 61 |erformance in ba|
|74 74 6C 65 20 69 73 20 74 68 65 20 6F 6E 6C 79 |ttle is the only|
|20 74 68 69 6E 67 20 74 68 61 74 20 6B 65 65 70 | thing that keep|
|73 20 74 68 65 20 68 6F 72 64 65 73 20 6F 66 20 |s the hordes of |
|43 68 61 6F 73 20 61 74 20 62 61 79 2E 20 4C 65 |Chaos at bay. Le|
|74 27 73 20 62 65 67 69 6E 20 79 6F 75 72 20 74 |t's begin your t|
|72 61 69 6E 69 6E 67 20 61 74 20 6F 6E 63 65 21 |raining at once!|
|00                                              |.               |");
                        }
                        else
                        {
                            Out.WritePacketString(@"|00 00 00 21 00 AA 4C 65 61 72 |.........!..Lear|
|6E 20 74 68 65 73 65 20 6C 65 73 73 6F 6E 73 20 |n these lessons |
|77 65 6C 6C 2C 20 66 6F 72 20 67 61 69 6E 69 6E |well, for gainin|
|67 20 74 68 65 20 66 61 76 6F 72 20 6F 66 20 74 |g the favor of t|
|68 65 20 52 61 76 65 6E 20 67 6F 64 20 73 68 6F |he Raven god sho|
|75 6C 64 20 62 65 20 6F 66 20 75 74 6D 6F 73 74 |uld be of utmost|
|20 69 6D 70 6F 72 74 61 6E 63 65 20 74 6F 20 79 | importance to y|
|6F 75 2E 20 4F 74 68 65 72 77 69 73 65 2E 2E 2E |ou. Otherwise...|
|20 54 68 65 72 65 20 69 73 20 61 6C 77 61 79 73 | There is always|
|20 72 6F 6F 6D 20 66 6F 72 20 6D 6F 72 65 20 53 | room for more S|
|70 61 77 6E 20 77 69 74 68 69 6E 20 6F 75 72 20 |pawn within our |
|72 61 6E 6B 73 2E 00                            |.......         |");
                        }
                        Plr.SendPacket(Out);
                    }
                } break;

                case GameData.InteractType.INTERACTTYPE_BANKER:
                {
                    PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
                    Out.WriteByte(0x1D);
                    Out.WriteByte(0);
                    Plr.SendPacket(Out);
                } break;

                default:
                    QtsInterface.HandleInteract(Plr, this, Menu);
                    break;
                }
                ;
            }

            base.SendInteract(Plr, Menu);
        }
        private void LoadPairing()
        {
            Log.Info("Battlefront.LoadPairing", " Region: " + Region.RegionId + " | LOADING CAMPAIGN");

            if (_battlefrontStatus == null)
            {
                Log.Error("Battlefront.LoadPairing", "No Battlefront Status - campaign resetting.");
                ResetPairing();
                return;
            }

            if (Constants.DoomsdaySwitch > 0)
            {
                PairingLocked = true;
                GraceDisabled = true;
            }
            else
            {
                PairingLocked = false;
                GraceDisabled = false;
            }

            for (int i = 0; i < _battlefrontStatus.OpenZoneIndex; ++i)
            {
                Log.Info("LoadPairing", "Setting ownership of " + Zones[i].Name + " to Destruction");
                LockZone(Realms.REALMS_REALM_DESTRUCTION, Zones[i].ZoneId, false, true);
                foreach (Keep keep in _Keeps)
                {
                    if (keep.Info.ZoneId == Zones[i].ZoneId)
                    {
                        keep.Realm = Realms.REALMS_REALM_DESTRUCTION;
                    }
                }
            }


            if (Constants.DoomsdaySwitch > 0)
            {
                LockZone(Realms.REALMS_REALM_NEUTRAL, Zones[_battlefrontStatus.OpenZoneIndex].ZoneId, false, true);
            }
            else
            {
                LiftZoneLock(Zones[_battlefrontStatus.OpenZoneIndex].ZoneId, true);
                Log.Info("LoadPairing", "Setting ownership of " + Zones[_battlefrontStatus.OpenZoneIndex].Name + " to Contested");
            }



            for (int i = _battlefrontStatus.OpenZoneIndex + 1; i < 3; ++i)
            {
                LockZone(Realms.REALMS_REALM_ORDER, Zones[i].ZoneId, false, true);
                Log.Info("LoadPairing", "Setting ownership of " + Zones[i].Name + " to Order");
                foreach (Keep keep in _Keeps)
                {
                    if (keep.Info.ZoneId == Zones[i].ZoneId)
                    {
                        keep.Realm = Realms.REALMS_REALM_ORDER;
                    }
                }
            }

            LockingRealm   = Realms.REALMS_REALM_NEUTRAL;
            DefendingRealm = Realms.REALMS_REALM_NEUTRAL;
            WorldMgr.SendCampaignStatus(null);
        }
Exemplo n.º 10
0
        public void SetMount(uint Id)
        {
            Mount_Info Info = WorldMgr.GetMount(Id);

            SetMount(Info);
        }
        public void LiftZoneLock(int zoneId, bool reset)
        {
            long _BOLockTime = (int)(10 * 60 * 1000 * TIMER_MODIFIER);

            #if (DEBUG)
            _BOLockTime = (1 * 60 * 1000);
            #endif

            PairingLocked = false;
            GraceDisabled = false;

            DefendingRealm = Realms.REALMS_REALM_NEUTRAL;

            if (Constants.DoomsdaySwitch > 0)
            {
                _battlefrontStatus.OpenZoneIndex      = Zones.FindIndex(z => z.ZoneId == zoneId);
                _battlefrontStatus.ActiveRegionOrZone = zoneId;
                WorldMgr.Database.SaveObject(_battlefrontStatus);
            }
            else
            {
                if (!reset)
                {
                    _battlefrontStatus.OpenZoneIndex      = Zones.FindIndex(z => z.ZoneId == zoneId);
                    _battlefrontStatus.ActiveRegionOrZone = zoneId;
                    WorldMgr.Database.SaveObject(_battlefrontStatus);
                }
            }

            _held[Zones.FindIndex(z => z.ZoneId == zoneId), 0] = 0;
            _held[Zones.FindIndex(z => z.ZoneId == zoneId), 1] = 0;

            HeldObjectives[0] = 0;
            HeldObjectives[1] = 0;

            foreach (BattlefrontFlag flag in _Objectives)
            {
                if (flag.ZoneId == zoneId)
                {
                    flag.OpenObjective(Realms.REALMS_REALM_NEUTRAL, _BOLockTime);
                }
            }

            foreach (Keep keep in _Keeps)
            {
                if (keep.Info.ZoneId == zoneId)
                {
                    keep.NotifyPairingUnlocked();

                    foreach (KeepDoor door in keep.Doors)
                    {
                        door.GameObject?.SetAttackable(keep.KeepStatus != KeepStatus.KEEPSTATUS_LOCKED && CanAttackDoor(keep.Realm, keep.Info.ZoneId));
                    }
                }
            }

            // Where 0 = Destromost zone, and 2 = Ordermost zone
            int campaignProgress = Zones.FindIndex(z => z.ZoneId == zoneId);

            lock (Player._Players)
            {
                foreach (Player plr in Player._Players)
                {
                    if (!plr.ValidInTier(Tier, true))
                    {
                        continue;
                    }

                    plr.SendLocalizeString(Zones[campaignProgress].Name + " battlefield objectives will soon be open for capture!", ChatLogFilters.CHATLOGFILTERS_RVR, Localized_text.CHAT_TAG_DEFAULT);
                    plr.SendLocalizeString(Zones[campaignProgress].Name + " battlefield objectives will soon be open for capture!", plr.Realm == Realms.REALMS_REALM_ORDER ? ChatLogFilters.CHATLOGFILTERS_C_ORDER_RVR_MESSAGE : ChatLogFilters.CHATLOGFILTERS_C_DESTRUCTION_RVR_MESSAGE, Localized_text.CHAT_TAG_DEFAULT);
                }
            }

            WorldMgr.SendCampaignStatus(null);
        }
        public void LockZone(Realms realm, int zoneId, bool announce, bool reset, bool noRewards = false)
        {
            Log.Debug("Battlefront.LockT4Zone", "Locking zone " + zoneId + " for " + realm);

            foreach (BattlefrontFlag flag in _Objectives)
            {
                if (flag.ZoneId == zoneId)
                {
                    flag.LockObjective(realm, announce);
                }
            }

            if (realm == Realms.REALMS_REALM_ORDER)
            {
                _held[Zones.FindIndex(z => z.ZoneId == zoneId), 0] = 4;
                _held[Zones.FindIndex(z => z.ZoneId == zoneId), 1] = 0;
            }
            else
            {
                _held[Zones.FindIndex(z => z.ZoneId == zoneId), 0] = 0;
                _held[Zones.FindIndex(z => z.ZoneId == zoneId), 1] = 4;
            }

            HeldObjectives[0] = 0;
            HeldObjectives[1] = 0;

            foreach (Keep keep in _Keeps)
            {
                if (keep.Info.ZoneId == zoneId)
                {
                    Realms targetRealm = keep.GetContestedRealm();
                    Dictionary <uint, ContributionInfo> contributors = GetContributorsFromRealm(targetRealm);

                    if (contributors.Count > 0 && !noRewards)
                    {
                        Log.Info("ProgressingBattlefront", $"Creating gold chest for {keep.Info.Name} for {contributors.Count} {(targetRealm == Realms.REALMS_REALM_ORDER ? "Order" : "Destruction")} contributors");
                        GoldChest.Create(Region, keep.Info.PQuest, ref contributors, targetRealm == realm ? WinnerShare : LoserShare);
                    }

                    keep.LockKeep(realm, announce, reset);
                }
            }

            if (!announce)
            {
                return;
            }

            DisableSupplies();

            // Where 0 = Destromost zone, and 2 = Ordermost zone
            int campaignProgress = Zones.FindIndex(z => z.ZoneId == zoneId);

            string message;
            float  winnerRewardScale;

            if (realm == Realms.REALMS_REALM_DESTRUCTION)
            {
                campaignProgress = 2 - campaignProgress;
            }

            switch (campaignProgress)
            {
            case 0:
                // The realm has captured the zone closest to the enemy fort, leave the last zone locked and give them a reward
                UpdateStateOfTheRealm();
                PairingLocked = true;

                    #if DEBUG
                EvtInterface.AddEvent(EndGrace, 90 * 1000, 1);
                    #else
                EvtInterface.AddEvent(EndGrace, 10 * 60 * 1000, 1);
                    #endif


                Log.Info("Battlefront.LockT4Zone", "Locked all of region " + Region.RegionId);

                winnerRewardScale = 1.25f;

                if (realm == Realms.REALMS_REALM_ORDER)
                {
                    message = Zones[0].Name + " has been liberated by the forces of Order! The forces of Destruction have been cleansed from this region, but the fighting continues on elsewhere!";
                }
                else
                {
                    message = Zones[2].Name + " has been conquered by the forces of Destruction! The forces of Order flee like cowards, but the fighting continues on elsewhere!";
                }

                LockingRealm = realm;

                WorldMgr.EvaluateT4CampaignStatus(Region.RegionId);
                break;

            case 1:
                // The realm has captured the middle zone, unlock zone closest to enemy fort.
                if (Constants.DoomsdaySwitch > 0)
                {
                    LiftZoneLock(Zones[realm == Realms.REALMS_REALM_ORDER ? 0 : 2].ZoneId, true);
                }
                else
                {
                    LiftZoneLock(Zones[realm == Realms.REALMS_REALM_ORDER ? 0 : 2].ZoneId, false);
                }

                winnerRewardScale = 1f;

                if (realm == Realms.REALMS_REALM_ORDER)
                {
                    message        = Zones[1].Name + " has been reclaimed by the forces of Order! The forces of Destruction have retreated to " + Zones[0].Name + ", to build up for a renewed assault.";
                    DefendingRealm = Realms.REALMS_REALM_DESTRUCTION;
                }
                else
                {
                    message        = Zones[1].Name + " has been seized by the forces of Destruction! The forces of Order have fallen back to " + Zones[2].Name + " to make a last stand.";
                    DefendingRealm = Realms.REALMS_REALM_ORDER;
                }

                UpdateStateOfTheRealm();
                break;

            case 2:
                // The realm has recaptured the zone closest to their fort, unlock the middle zone
                if (Constants.DoomsdaySwitch > 0)
                {
                    LiftZoneLock(Zones[1].ZoneId, true);
                }
                else
                {
                    LiftZoneLock(Zones[1].ZoneId, false);
                }

                winnerRewardScale = 0.75f;

                if (realm == Realms.REALMS_REALM_ORDER)
                {
                    message = Zones[2].Name + " has been saved by the forces of Order! The forces of Destruction fall back to " + Zones[1].Name + "!";
                }
                else
                {
                    message = "The forces of Destruction tighten their grip on " + Zones[0].Name + ", and the forces of Order fall back to " + Zones[1].Name + "!";
                }

                DefendingRealm = Realms.REALMS_REALM_NEUTRAL;

                UpdateStateOfTheRealm();
                break;

            default:
                Log.Error("Battlefront.LockT4Zone", "The campaign progress was somehow at stage " + campaignProgress + ". This is not supposed to happen.");
                return;
            }

            VictoryPoints = 50;
            LastAnnouncedVictoryPoints = 50;

            WorldMgr.SendCampaignStatus(null);

            winnerRewardScale *= RelativeActivityFactor;

            try
            {
                Log.Info("Zone Lock", ZoneService.GetZone_Info((ushort)zoneId).Name);
                HandleLockReward(realm, winnerRewardScale, message, zoneId);
            }
            catch (Exception e)
            {
                Log.Error("HandleLockReward", "Exception thrown: " + e);
            }

            TotalContribFromRenown = (ulong)(Tier * 50);

            PlayerContributions.Clear();

            int arr;
            if (Constants.DoomsdaySwitch == 2)
            {
                arr = (int)pairing;
            }
            else
            {
                arr = Tier;
            }

            if (BattlefrontList.ActiveFronts[arr - 1] == this)
            {
                BattlefrontList.ActiveFronts[arr - 1] = null;
            }

            if (Constants.DoomsdaySwitch == 2)
            {
                foreach (Battlefront b in BattlefrontList.Battlefronts[Tier - 1])
                {
                    if (b != this && !b.PairingLocked && b.pairing == pairing)
                    {
                        b.EvtInterface.AddEvent(b.SupplyLineReset, 1, 1);
                    }
                }
            }
            else
            {
                foreach (Battlefront b in BattlefrontList.Battlefronts[Tier - 1])
                {
                    if (b != this && !b.PairingLocked)
                    {
                        b.EvtInterface.AddEvent(b.SupplyLineReset, 1, 1);
                    }
                }
            }
        }
Exemplo n.º 13
0
        public override void OnLoad()
        {
            InteractType = GenerateInteractType(Spawn.Title != 0 ? Spawn.Title : Spawn.Proto.Title);

            SetFaction(Spawn.Faction != 0 ? Spawn.Faction : Spawn.Proto.Faction);

            ItmInterface.Load(WorldMgr.GetCreatureItems(Spawn.Entry));
            if (Spawn.Proto.MinLevel > Spawn.Proto.MaxLevel)
            {
                Spawn.Proto.MinLevel = Spawn.Proto.MaxLevel;
            }

            if (Spawn.Proto.MaxLevel <= Spawn.Proto.MinLevel)
            {
                Spawn.Proto.MaxLevel = Spawn.Proto.MinLevel;
            }

            if (Spawn.Proto.MaxLevel == 0)
            {
                Spawn.Proto.MaxLevel = 1;
            }
            if (Spawn.Proto.MinLevel == 0)
            {
                Spawn.Proto.MinLevel = 1;
            }

            Level = (byte)RandomMgr.Next((int)Spawn.Proto.MinLevel, (int)Spawn.Proto.MaxLevel + 1);
            StsInterface.SetBaseStat((byte)GameData.Stats.STATS_WOUNDS, GenerateWounds(Level, Rank));
            StsInterface.ApplyStats();
            Health = TotalHealth;

            X = Zone.CalculPin((uint)(Spawn.WorldX), true);
            Y = Zone.CalculPin((uint)(Spawn.WorldY), false);
            Z = (ushort)(Spawn.WorldZ);
            if (Zone.ZoneId == 161)
            {
                Z += 16384;
                X += 16384;
                Y += 16384;
            }

            // TODO : Bad Height Formula

            /*int HeightMap = HeightMapMgr.GetHeight(Zone.ZoneId, X, Y);
             * if (Z < HeightMap)
             * {
             *  Log.Error("Creature", "["+Spawn.Entry+"] Invalid Height : Min=" + HeightMap + ",Z=" + Z);
             *  return;
             * }*/

            Heading         = (ushort)Spawn.WorldO;
            WorldPosition.X = Spawn.WorldX;
            WorldPosition.Y = Spawn.WorldY;
            WorldPosition.Z = Spawn.WorldZ;

            SetOffset((ushort)(Spawn.WorldX >> 12), (ushort)(Spawn.WorldY >> 12));
            ScrInterface.AddScript(Spawn.Proto.ScriptName);
            base.OnLoad();

            if (Spawn.Title == 0 && Spawn.Icone == 0 && Spawn.Proto.Title == 0 && Spawn.Icone == 0 && Spawn.Emote == 0 && Spawn.Proto.FinishingQuests == null && Spawn.Proto.StartingQuests == null)
            {
                if (Faction <= 1 || Faction == 128 || Faction == 129)
                {
                    SFastRandom Random = new SFastRandom(X ^ Y ^ Z);

                    for (int i = 0; i < 3; ++i)
                    {
                        Waypoint Wp = new Waypoint();
                        Wp.X           = (ushort)(X + Random.randomInt(50) + Random.randomInt(100) + Random.randomInt(150));
                        Wp.Y           = (ushort)(Y + Random.randomInt(50) + Random.randomInt(100) + Random.randomInt(150));
                        Wp.Z           = (ushort)Z;
                        Wp.Speed       = 10;
                        Wp.WaitAtEndMS = (uint)(5000 + Random.randomIntAbs(10) * 1000);
                        AiInterface.AddWaypoint(Wp);
                    }
                }
            }

            IsActive = true;
        }
Exemplo n.º 14
0
 public bool HasQuestStarter(UInt16 QuestID)
 {
     return(WorldMgr.GetStartQuests(Entry).Find(info => info.Entry == QuestID) != null);
 }
Exemplo n.º 15
0
        public override void OnLoad()
        {
            InteractType = GenerateInteractType(Spawn.Title != 0 ? Spawn.Title : Spawn.Proto.Title);

            SetFaction(Spawn.Faction != 0 ? Spawn.Faction : Spawn.Proto.Faction);

            ItmInterface.Load(WorldMgr.GetCreatureItems(Spawn.Entry));
            if (Spawn.Proto.MinLevel > Spawn.Proto.MaxLevel)
            {
                Spawn.Proto.MinLevel = Spawn.Proto.MaxLevel;
            }

            if (Spawn.Proto.MaxLevel <= Spawn.Proto.MinLevel)
            {
                Spawn.Proto.MaxLevel = Spawn.Proto.MinLevel;
            }

            if (Spawn.Proto.MaxLevel == 0)
            {
                Spawn.Proto.MaxLevel = 1;
            }
            if (Spawn.Proto.MinLevel == 0)
            {
                Spawn.Proto.MinLevel = 1;
            }


            if (Spawn.Level != 0)
            {
                if (Spawn.Level > 2)
                {
                    Level = (byte)RandomMgr.Next((int)Spawn.Level - 1, Spawn.Level + 1);
                }
                else
                {
                    Level = (byte)RandomMgr.Next((int)Spawn.Level, Spawn.Level + 1);
                }
            }
            else
            {
                Level = (byte)RandomMgr.Next((int)Spawn.Proto.MinLevel, (int)Spawn.Proto.MaxLevel + 1);
            }
            StsInterface.SetBaseStat((byte)GameData.Stats.STATS_WOUNDS, GenerateWounds(Level, Rank));
            StsInterface.ApplyStats();
            Health = TotalHealth;

            X = Zone.CalculPin((uint)(Spawn.WorldX), true);
            Y = Zone.CalculPin((uint)(Spawn.WorldY), false);
            Z = (ushort)(Spawn.WorldZ);

            /*
             * if (Zone.ZoneId == 161)
             * {
             *  Z += 16384;
             *  X += 16384;
             *  Y += 16384;
             * }
             * //*/
            // TODO : Bad Height Formula

            /*
             * //int HeightMap = HeightMapMgr.GetHeight(Zone.ZoneId, X, Y);
             * int HeightMap = ClientFileMgr.GetHeight(Zone.ZoneId, X, Y);
             *
             * if (Z < HeightMap)
             * {
             *  Log.Error("Creature", "["+Spawn.Entry+"] Invalid Height : Min=" + HeightMap + ",Z=" + Z);
             *  return;
             * }*/

            Heading         = (ushort)Spawn.WorldO;
            WorldPosition.X = Spawn.WorldX;
            WorldPosition.Y = Spawn.WorldY;
            WorldPosition.Z = Spawn.WorldZ;

            SetOffset((ushort)(Spawn.WorldX >> 12), (ushort)(Spawn.WorldY >> 12));
            ScrInterface.AddScript(Spawn.Proto.ScriptName);
            base.OnLoad();

            /*AiInterface.Waypoints = WorldMgr.GetNpcWaypoints(Spawn.Guid);
             *
             * if (Spawn.Title == 0 && Spawn.Icone == 0 && Spawn.Proto.Title == 0 && Spawn.Icone == 0 && Spawn.Emote == 0 && Spawn.Proto.FinishingQuests == null && Spawn.Proto.StartingQuests == null)
             * {
             *  if (Faction <= 1 || Faction == 128 || Faction == 129)
             *  {
             *      if (AiInterface.Waypoints.Count <= 4)
             *      {
             *          int i = 0;
             *          if (AiInterface.Waypoints.Count != 0)
             *              i = AiInterface.Waypoints.Count - 1;
             *          for (; i < 3; ++i)
             *          {
             *              AiInterface.AddWaypoint(new Waypoint());
             *          }
             *      }
             *      foreach (Waypoint Wp in AiInterface.Waypoints)
             *      {
             *          AiInterface.RandomizeWaypoint(Wp);
             *      }
             *  }
             * }*/
            IsActive = true;

            if (InteractType == GameData.InteractType.INTERACTTYPE_TRAINER)
            {
                States.Add(1);
            }

            if (InteractType == GameData.InteractType.INTERACTTYPE_BANKER)
            {
                States.Add(11);                                                 // 11
            }
            if (InteractType == GameData.InteractType.INTERACTTYPE_GUILD_VAULT) // added
            {
                States.Add(0);                                                  // dont know what states are yet ?
            }
            if (InteractType == GameData.InteractType.INTERACTTYPE_AUCTIONEER)
            {
                States.Add(12);
            }

            if (InteractType == GameData.InteractType.INTERACTTYPE_GUILD_REGISTRAR)
            {
                States.Add(14);
            }

            if (InteractType == GameData.InteractType.INTERACTTYPE_FLIGHT_MASTER)
            {
                States.Add(15);
            }

            if (InteractType == GameData.InteractType.INTERACTTYPE_DYEMERCHANT)
            {
                States.Add(26);
            }
        }
Exemplo n.º 16
0
        public void HandleInteract(Player Plr, InteractMenu Menu)
        {
            if (Entry == 0)
            {
                return;
            }

            List <Quest> Starter    = WorldMgr.GetStartQuests(Entry);
            List <Quest> Finisher   = WorldMgr.GetFinishersQuests(Entry);
            List <Quest> InProgress = Starter != null?Starter.FindAll(info => Plr.QtsInterface.HasQuest(info.Entry) && !Plr.QtsInterface.HasDoneQuest(info.Entry)) : null;

            string Text = WorldMgr.GetCreatureText(Entry);

            if (Starter == null && Finisher == null && Text.Length <= 0 && InProgress == null)
            {
                return;
            }

            PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);

            Out.WriteByte(0);
            Out.WriteUInt16(Obj.Oid);
            Out.Fill(0, 3);
            Out.WriteByte(0x60);
            Out.WriteUInt32(0);
            Out.WriteUInt16(Plr.Oid);

            if (Starter != null)
            {
                List <Quest> Starts = Starter.FindAll(q => Plr.QtsInterface.CanStartQuest(q));

                Log.Success("QuestInterface", "Handle Interact : Starts=" + Starts.Count);

                Out.WriteByte((byte)Starts.Count);
                foreach (Quest Q in Starts)
                {
                    Out.WriteByte(0);
                    Out.WriteUInt16(Q.Entry);
                    Out.WriteUInt16(0);
                    Out.WritePascalString(Q.Name);
                }
            }
            else
            {
                Out.WriteByte(0);
            }

            if (Finisher != null)
            {
                List <Quest> Finishs = Finisher.FindAll(q => Plr.QtsInterface.CanEndQuest(q));

                Log.Success("QuestInterface", "Handle Interact : Finishs=" + Finishs.Count);

                Out.WriteByte((byte)Finishs.Count);
                foreach (Quest Q in Finishs)
                {
                    Out.WriteByte(0);
                    Out.WriteUInt16(Q.Entry);
                    Out.WritePascalString(Q.Name);
                }
            }
            else if (InProgress != null)
            {
                Log.Success("QuestInterface", "Handle Interact : InProgress=" + InProgress.Count);

                Out.WriteByte((byte)InProgress.Count);
                foreach (Quest Q in InProgress)
                {
                    Out.WriteByte(0);
                    Out.WriteUInt16(Q.Entry);
                    Out.WritePascalString(Q.Name);
                }
            }
            else
            {
                Out.WriteByte(0);
            }

            Log.Info("QTS", "Text=" + Text);
            Out.WriteUInt16((ushort)Text.Length);
            Out.WriteStringBytes(Text);
            Out.WriteByte(0);

            Plr.SendPacket(Out);
        }
Exemplo n.º 17
0
        public override void SendInteract(Player Plr, InteractMenu Menu)

        {
            Log.Success("SendInteract", "" + Name + " -> " + Plr.Name + ",Type=" + InteractType);


            PacketOut Out = new PacketOut((byte)Opcodes.F_SET_ABILITY_TIMER);

            Out.WriteByte(0);                    // 00
            Out.WriteByte(1);                    // 01
            Out.WriteByte(1);                    // 01
            Out.WriteByte(5);                    // 05
            Out.WriteUInt16(0);                  //00 00
            Out.WriteUInt16(Spawn.GameObjTimer); // 13 88 =5000
            Out.WriteUInt16(Oid);
            Out.WriteUInt16(0);
            Plr.SendPacket(Out);


            if (Spawn.GameObjTimer == 0)

            {
                Out = new PacketOut((byte)Opcodes.F_SET_ABILITY_TIMER);
                Out.WriteByte(0);   // 00
                Out.WriteByte(1);   // 01
                Out.WriteByte(1);   // 01
                Out.WriteUInt16(0); //00 00
                Out.WriteUInt16(0); // 13 88
                Out.WriteUInt16(0);
                Out.WriteUInt16(0);
                Out.WriteByte(0);

                Plr.SendPacket(Out);
            }


            Out = new PacketOut((byte)Opcodes.F_PLAY_EFFECT);
            Out.WriteUInt16((UInt16)0x0144);
            Out.WriteByte(0);// 00
            Out.WriteUInt16((UInt16)Spawn.WorldZ);
            Out.WriteUInt32((UInt32)Spawn.WorldX);
            Out.WriteUInt32((UInt32)Spawn.WorldY);
            Out.WriteUInt16(0x0017);// 00 17
            Out.Fill(0, 5);
            Plr.SendPacket(Out);



            Tok_Info Info = WorldMgr.GetTok(Spawn.Proto.TokUnlock);

            if (!IsDead)
            {
                Plr.QtsInterface.HandleEvent(Objective_Type.QUEST_USE_GO, Spawn.Entry, 1);
            }

            if (Spawn.Proto.TokUnlock != 0)
            {
                Plr.TokInterface.AddTok(Info);
            }

            Loot Loots = LootsMgr.GenerateLoot(this, Plr);

            if (Loots != null)
            {
                Loots.SendInteract(Plr, Menu);
                // If object has been looted, make it unlootable
                // and then Reset its lootable staus in XX seconds
                if (!Loots.IsLootable())
                {
                    Looted = true;
                    foreach (Object Obj in this._ObjectRanged)
                    {
                        if (Obj.IsPlayer())
                        {
                            this.SendMeTo(Obj.GetPlayer());
                        }
                    }
                    EvtInterface.AddEvent(ResetLoot, RELOOTABLE_TIME, 1);
                }
            }



            if (Spawn.DoorId != 0)
            {
                if (DoorOpen)
                {
                    CloseDoor();
                }
                else
                {
                    OpenDoor();
                }
            }



            base.SendInteract(Plr, Menu);
        }