示例#1
0
文件: Door.cs 项目: dzikun/WarEmu
        public override void OnInteract(Object Obj, Player Target, InteractMenu Menu)
        {
            GameObject go = Obj.GetGameObject();

            float dx = go.Spawn.WorldX - Target._Value.WorldX;
            float dy = go.Spawn.WorldY - Target._Value.WorldY;

            double heading = Math.Atan2(-dx, dy);

            if (heading < 0)
                heading += 4096;

            int distance = (int)((float)5 * 13.2f);
            double angle = heading;
            double targetX = go.Spawn.WorldX - (Math.Sin(angle) * distance);
            double targetY = go.Spawn.WorldY + (Math.Cos(angle) * distance);

            int newX;
            int newY;

            if (targetX > 0)
                newX = (int)targetX;
            else
                newX = 0;

            if (targetY > 0)
                newY = (int)targetY;
            else
                newY = 0;

            Target.SafeWorldTeleport((uint)newX, (uint)newY, (ushort)go.Spawn.WorldZ, (ushort)Target._Value.WorldO);
        }
示例#2
0
        public void BuyBackItem(InteractMenu Menu)
        {
            UInt16 SlotId = (ushort)(BuyBack.Count - 1 - (Menu.Num + (Menu.Page * 256)));

            Log.Success("BuyBackItem", "SlotId=" + SlotId);

            UInt16 FreeSlot = GetFreeInventorySlot();

            if (FreeSlot <= 0)
            {
                GetPlayer().SendLocalizeString("", GameData.Localized_text.TEXT_MERCHANT_INSUFFICIENT_SPACE_TO_BUY);
                return;
            }

            Item Itm = GetBuyBack(SlotId, Menu.Count);

            if (Itm == null || !GetPlayer().RemoveMoney(Itm.Count * Itm.Info.SellPrice))
            {
                GetPlayer().SendLocalizeString("", GameData.Localized_text.TEXT_MERCHANT_INSUFFICIENT_MONEY_TO_BUY);
                return;
            }

            Items[FreeSlot] = Itm;
            Itm.SlotId      = FreeSlot;

            SendItems(GetPlayer(), new ushort[] { FreeSlot });
            SendBuyBack();
        }
示例#3
0
        public override void SendInteract(Player player, InteractMenu menu)
        {
            Vector2 toPlayerVec = new Vector2(player.WorldPosition.X - WorldPosition.X, player.WorldPosition.Y - WorldPosition.Y);

            float dist = Vector2.DotProduct2D(toPlayerVec, _unitDirVec);

            if (Math.Abs(dist) * 0.083f > _info.MaxInteractionDist)
            {
                player.SendClientMessage("Too far from palisade", ChatLogFilters.CHATLOGFILTERS_C_ABILITY_ERROR);
                player.SendClientMessage("Too far away from the " + _info.Name);
                return;
            }

            if (player.Palisade != null && player.Palisade != this)
            {
                player.SendClientMessage("Already in cover", ChatLogFilters.CHATLOGFILTERS_C_ABILITY_ERROR);
                player.SendClientMessage("Already interacting with another palisade.");
                return;
            }

            switch (_buildState)
            {
            case EConstructionState.Constructing:
                BeginInteraction(player);
                break;

            case EConstructionState.Active:
                HandleUser(player);
                break;
            }

            _logger.Debug($"RVRStructure Sendinteract Oid={Oid} {IsActive} {_buildState} {Faction} {Realm} {Level} {X} {Y} {Z} {XOffset} {YOffset} ");
        }
示例#4
0
        public static void F_INTERACT(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            if (cclient.Plr == null || !cclient.Plr.IsInWorld())
                return;

            Log.Dump("F_INTERACT", packet.ToArray(), 0, packet.ToArray().Length);

            InteractMenu Menu = new InteractMenu();
            Menu.Unk = packet.GetUint16();
            Menu.Oid = packet.GetUint16();
            Menu.Menu = packet.GetUint16();
            Menu.Page = packet.GetUint8();
            Menu.Num = packet.GetUint8();
            Menu.SellCount = packet.GetUint16();
            Menu.Count = packet.GetUint16();

            Object Obj = cclient.Plr.Region.GetObject(Menu.Oid);
            if (Obj == null)
                return;

            if (Obj.GetDistanceTo(cclient.Plr) > 20)
            {
                Log.Error("F_INTERACT", "Distance = " + Obj.GetDistanceTo(cclient.Plr));
                return;
            }

            Obj.SendInteract(cclient.Plr, Menu);
        }
        public override void SendInteract(Player player, InteractMenu menu)
        {
            switch (menu.Menu)
            {
            case 15:     // Fermeture du loot
                return;

            case 13:     // Récupération de tous les items
                TakeAll(player);
                break;

            case 12:     // Récupération d'un item
                TakeLoot(player);
                break;
            }

            GoldBag bag;

            if (_lootBags.TryGetValue(player.CharacterId, out bag))
            {
                PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE, 32);
                Out.WriteByte(4);
                Out.WriteByte(1);
                Out.WriteByte(1);
                Item.BuildItem(ref Out, null, ItemService.GetItem_Info(bag.bagWon), null, 0, 1);
                player.SendPacket(Out);
            }
            else
            {
                PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE, 32);
                Out.WriteByte(4);
                Out.WriteByte(0);
                player.SendPacket(Out);
            }
        }
示例#6
0
文件: LootsMgr.cs 项目: dzikun/WarEmu
        public void SendInteract(Player Plr, InteractMenu Menu)
        {
            if (Money > 0)
            {
                if (Plr.GetGroup() == null)
                {
                    Plr.AddMoney(Money);
                }
                else
                {
                    Plr.GetGroup().AddMoney(Money / (uint)Plr.GetGroup().Size());
                }
                Money = 0;
            }

            switch (Menu.Menu)
            {
                case 15: // Fermeture du loot

                    return;

                case 13: // Récupération de tous les items
                    if (Plr.ItmInterface.GetTotalFreeInventorySlot() < GetLootCount())
                        Plr.SendLocalizeString("", GameData.Localized_text.TEXT_OVERAGE_CANT_LOOT);
                    else
                    {
                        for (byte i = 0; i < Loots.Count; ++i)
                        {
                            if (Loots[i] == null)
                                continue;

                            TakeLoot(Plr, i);
                        }
                    }

                    break;

                case 12: // Récupération d'un item
                    TakeLoot(Plr, Menu.Num);
                    break;
            }
                

            PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
            Out.WriteByte(4);
            Out.WriteByte(GetLootCount());

            for (byte i = 0; i < Loots.Count; ++i)
            {
                if (Loots[i] == null)
                    continue;

                Out.WriteByte(i);
                Item.BuildItem(ref Out, null, Loots[i].Item, 0, 1);
            }

            Plr.SendPacket(Out);
        }
示例#7
0
        public void SendInteract(Player Plr, InteractMenu Menu)
        {
            if (Money > 0)
            {
                Plr.AddMoney(Money);
                Money = 0;
            }

            switch (Menu.Menu)
            {
            case 15:     // Fermeture du loot

                return;

            case 13:     // Récupération de tous les items
                if (Plr.ItmInterface.GetTotalFreeInventorySlot() < GetLootCount())
                {
                    Plr.SendLocalizeString("", GameData.Localized_text.TEXT_OVERAGE_CANT_LOOT);
                }
                else
                {
                    for (byte i = 0; i < Loots.Length; ++i)
                    {
                        if (Loots[i] == null)
                        {
                            continue;
                        }

                        TakeLoot(Plr, i);
                    }
                }

                break;

            case 12:     // Récupération d'un item
                TakeLoot(Plr, Menu.Num);
                break;
            }


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

            Out.WriteByte(4);
            Out.WriteByte(GetLootCount());

            for (byte i = 0; i < Loots.Length; ++i)
            {
                if (Loots[i] == null)
                {
                    continue;
                }

                Out.WriteByte(i);
                Item.BuildItem(ref Out, null, Loots[i].Item, 0, 1);
            }

            Plr.SendPacket(Out);
        }
        public void OnInteract(Object Obj, Player Target, InteractMenu Menu)
        {
            //Log.Info("ScriptsInterface", "OnInteract Scripts : " + Scripts.Count);

            for (int i = 0; i < Scripts.Count; ++i)
            {
                Scripts[i].OnInteract(Obj, Target, Menu);
            }
        }
        public override void SendInteract(Player player, InteractMenu menu)
        {
            if (IsDead)
            {
                TryLoot(player, menu);
            }

            base.SendInteract(player, menu);
        }
        public override void SendInteract(Player player, InteractMenu menu)
        {
            if (_captureCheck != null && !_captureCheck(player))
            {
                return;
            }

            if (CaptureDuration > 0)
            {
                BeginInteraction(player);
            }

            else
            {
                HandleInteractionEvents(player);

                TryLoot(player, menu);

                switch (Spawn.Entry)
                {
                case 242:
                case 100132:
                case 99667:
                case 98845:
                case 344:
                case 100575:
                case 100576:
                case 100577:
                case 100578:
                case 99644:
                case 100610:
                case 100611:
                case 100612:
                    ZoneJump(player);
                    return;

                case 98878:     // Hardcoded portal for Gunbad
                    ZoneJump(player, 60);
                    return;
                }

                if (Spawn.DoorId != 0)
                {
                    if (VfxState == 0)
                    {
                        OpenDoor(true);
                    }
                }

                else
                {
                    Region?.Scenario?.Interact(this, player, menu);

                    base.SendInteract(player, menu);
                }
            }
        }
示例#11
0
        public override void SendInteract(Player player, InteractMenu menu)
        {
            if (!player.ValidInTier(Region.GetTier(), true))
            {
                player.SendClientMessage("You are too low level to interact with resources here", ChatLogFilters.CHATLOGFILTERS_C_ABILITY_ERROR);
                return;
            }

            base.SendInteract(player, menu);
        }
示例#12
0
        public override void SendInteract(Player player, InteractMenu menu)
        {
            uint itemid = 0;

            switch (Bannertyp)
            {
            case 0: itemid = (uint)(RealmStandard == Realms.REALMS_REALM_DESTRUCTION ? 187704 : 187701); break;

            case 1: itemid = (uint)(RealmStandard == Realms.REALMS_REALM_DESTRUCTION ? 187705 : 187702); break;

            case 2: itemid = (uint)(RealmStandard == Realms.REALMS_REALM_DESTRUCTION ? 187706 : 187703); break;
            }


            if (player == Owner)
            {
                if (player.ItmInterface.GetItemInSlot(14) == null)
                {
                    player.ItmInterface.CreateItem(ItemService.GetItem_Info(itemid), 1, 14);
                    player.ItmInterface.SendEquipped(player);
                    player.ItmInterface.SendEquipped(null);
                }
                else
                {
                    player.ItmInterface.CreateItem(ItemService.GetItem_Info(itemid), 1);
                }
            }
            else if (player.Realm == RealmStandard)
            {
                Character_mail Mail = new Character_mail();
                Mail.Guid              = CharMgr.GenerateMailGuid();
                Mail.CharacterId       = Owner.CharacterId;
                Mail.CharacterIdSender = player.CharacterId;
                Mail.SenderName        = player.Name;
                Mail.ReceiverName      = Owner.Name;
                Mail.SendDate          = (uint)TCPManager.GetTimeStamp();
                Mail.Title             = "Guild Standard";
                Mail.Content           = "Found your Guild Standard";
                Mail.Money             = 0;
                Mail.Opened            = false;
                Mail.Items.Add(new MailItem(itemid, 1));
                CharMgr.AddMail(Mail);
            }
            else
            {
                player.AddRenown(600, false);
            }


            player.PlantedStandard = null;
            Dispose();
        }
示例#13
0
        public override void SendInteract(Player Plr, InteractMenu Menu)
        {
            Tok_Info Info = WorldMgr.GetTok((UInt32)Spawn.Proto.TokUnlock);

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

            Plr.TokInterface.AddTok(Info.Entry);

            base.SendInteract(Plr, Menu);
        }
示例#14
0
        public override void SendInteract(Player Plr, InteractMenu Menu)
        {
            Tok_Info Info = WorldMgr.GetTok((UInt32)Spawn.Proto.TokUnlock);

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

            Plr.TokInterface.AddTok(Info.Entry);

            base.SendInteract(Plr, Menu);
        }
示例#15
0
        public override void SendInteract(Player Plr, InteractMenu Menu)
        {
            if (IsDead && Loots != null)
            {
                Loots.SendInteract(Plr, Menu);
                if (!Loots.IsLootable())
                {
                    SetLootable(false, Plr);
                }
            }

            base.SendInteract(Plr, Menu);
        }
        public virtual void TryLoot(Player player, InteractMenu menu)
        {
            if (lootContainer != null && lootContainer.IsLootable())
            {
                player.PriorityGroup?.GroupLoot(player, lootContainer);

                lootContainer.SendInteract(player, menu);

                if (!lootContainer.IsLootable())
                {
                    SetLootable(false, player);
                }
            }
        }
示例#17
0
        public override void OnInteract(Object Obj, Player Target, InteractMenu Menu)
        {
            // Make sure the player has the quest and hasn't already finished the objectives.
            if (!Target.GetPlayer().QtsInterface.HasQuest(30001) || Target.GetPlayer().QtsInterface.HasFinishQuest(30001))
            {
                return;
            }

            Target.GetPlayer().QtsInterface.HandleEvent(Objective_Type.QUEST_UNKNOWN, 1314, 1, true);

            Creature c    = Obj.GetCreature();
            Random   rand = new Random();

            //  Make the villager say something
            Double chance = rand.NextDouble();

            if (chance >= 0.8)
            {
                c.Say("Thanks for saving me!", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);
            }
            else if (chance >= 0.6)
            {
                c.Say("Phew, that was close!", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);
            }
            else if (chance >= 0.4)
            {
                c.Say("Ahh, run for your life!", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);
            }
            else if (chance >= 0.2)
            {
                c.Say("I could have taken him myself!", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);
            }
            else
            {
                c.Say("Please help my friend!", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);
            }


            //  Make the villager run to either the start or the village
            chance = rand.NextDouble();
            if (chance >= 0.5)
            {
                c.GetCreature().MvtInterface.Move(22347, 53688, 7425);
            }
            else
            {
                c.GetCreature().MvtInterface.Move(15548, 51104, 7228);
            }
        }
        public override void TryLoot(Player player, InteractMenu menu)
        {
            LootContainer lootsContainer = LootsMgr.GenerateLoot(this, player, 1);

            if (lootsContainer != null)
            {
                lootsContainer.SendInteract(player, menu);
                // If object has been looted, make it unlootable
                // and then Reset its lootable staus in XX seconds
                if (!lootsContainer.IsLootable())
                {
                    Looted = true;
                    EvtInterface.AddEvent(ResetLoot, RELOOTABLE_TIME, 1);
                }
            }
        }
示例#19
0
        static public void BuyItemVendor(Player Plr, InteractMenu Menu, uint Entry)
        {
            int    Num   = (Menu.Page * MAX_ITEM_PAGE) + Menu.Num;
            ushort Count = (ushort)(Menu.Count > 0 ? Menu.Count : 1);
            List <Creature_vendor> Vendors = GetVendorItems(Entry);

            Log.Success("BuyItemVendor", "Count=" + Count + ",Num=" + Num + ",Size=" + Vendors.Count);

            if (Vendors.Count <= Num)
            {
                return;
            }

            if (!Plr.HaveMoney((Vendors[Num].Price) * Count))
            {
                Plr.SendLocalizeString("", GameData.Localized_text.TEXT_MERCHANT_INSUFFICIENT_MONEY_TO_BUY);
                return;
            }

            foreach (KeyValuePair <UInt16, Item_Info> Kp in Vendors[Num].ItemsReqInfo)
            {
                if (!Plr.ItmInterface.HasItemCount(Kp.Value.Entry, Kp.Key))
                {
                    Plr.SendLocalizeString("", GameData.Localized_text.TEXT_MERCHANT_FAIL_PURCHASE_REQUIREMENT);
                    return;
                }
            }

            ItemError Error = Plr.ItmInterface.CreateItem(Vendors[Num].Info, Count);

            if (Error == ItemError.RESULT_OK)
            {
                Plr.RemoveMoney((Vendors[Num].Price) * Count);
                foreach (KeyValuePair <UInt16, Item_Info> Kp in Vendors[Num].ItemsReqInfo)
                {
                    Plr.ItmInterface.RemoveItem(Kp.Value.Entry, Kp.Key);
                }
            }
            else if (Error == ItemError.RESULT_MAX_BAG)
            {
                Plr.SendLocalizeString("", GameData.Localized_text.TEXT_MERCHANT_INSUFFICIENT_SPACE_TO_BUY);
            }
            else if (Error == ItemError.RESULT_ITEMID_INVALID)
            {
            }
        }
示例#20
0
        public void SellItem(InteractMenu Menu)
        {
            UInt16 SlotId = (UInt16)(Menu.Num + (Menu.Page * 256));
            UInt16 Count  = Menu.Count;

            Log.Success("SellItem", "Count=" + Count + ",SlotId=" + SlotId);

            List <UInt16> ToSend = new List <ushort>();
            Item          Itm    = GetItemInSlot(SlotId);

            if (Itm == null || Itm.Info.SellPrice <= 0)
            {
                return;
            }

            if (Count <= 0 || Count > Itm.Count)
            {
                Count = Itm.Count;
            }

            ToSend.Add(SlotId);

            if (Count == Itm.Count)
            {
                Items[SlotId] = null;
                AddBuyBack(Itm);
            }
            else if (Count < Itm.Count)
            {
                Itm.Count -= Count;

                Item New = new Item(Obj);
                if (!New.Load(Itm.Info, 0, Count))
                {
                    return;
                }
                AddBuyBack(New);
            }

            GetPlayer().AddMoney((uint)Itm.Info.SellPrice * Count);

            SendItems(GetPlayer(), ToSend.ToArray());
            SendBuyBack();
        }
        public override void OnInteract(Object Obj, Player Target, InteractMenu Menu)
        {
            GameObject go = Obj.GetGameObject();

            float dx = go.Spawn.WorldX - Target._Value.WorldX;
            float dy = go.Spawn.WorldY - Target._Value.WorldY;

            double heading = Math.Atan2(-dx, dy);

            if (heading < 0)
            {
                heading += 4096;
            }

            const int distance = (int)((float)5 * 13.2f);
            double    angle    = heading;
            double    targetX  = go.Spawn.WorldX - (Math.Sin(angle) * distance);
            double    targetY  = go.Spawn.WorldY + (Math.Cos(angle) * distance);

            int newX;
            int newY;

            if (targetX > 0)
            {
                newX = (int)targetX;
            }
            else
            {
                newX = 0;
            }

            if (targetY > 0)
            {
                newY = (int)targetY;
            }
            else
            {
                newY = 0;
            }

            Target.IntraRegionTeleport((uint)newX, (uint)newY, (ushort)go.Spawn.WorldZ, (ushort)Target._Value.WorldO);
        }
示例#22
0
        public static void BuyItemVendor(Player Plr, InteractMenu Menu,uint Entry)
        {
            int Num = (Menu.Page * MAX_ITEM_PAGE) + Menu.Num;
            ushort Count = (ushort)(Menu.Count > 0 ? Menu.Count : 1);
            List<Creature_vendor> Vendors = GetVendorItems(Entry);

            Log.Success("BuyItemVendor", "Count=" + Count + ",Num=" + Num + ",Size=" + Vendors.Count);

            if (Vendors.Count <= Num)
                return;

            if (!Plr.HaveMoney((Vendors[Num].Price) * Count))
            {
                Plr.SendLocalizeString("", GameData.Localized_text.TEXT_MERCHANT_INSUFFICIENT_MONEY_TO_BUY);
                return;
            }

            foreach (KeyValuePair<UInt16, Item_Info> Kp in Vendors[Num].ItemsReqInfo)
            {
                if (!Plr.ItmInterface.HasItemCount(Kp.Value.Entry, Kp.Key))
                {
                    Plr.SendLocalizeString("", GameData.Localized_text.TEXT_MERCHANT_FAIL_PURCHASE_REQUIREMENT);
                    return;
                }
            }

            ItemError Error = Plr.ItmInterface.CreateItem(Vendors[Num].Info, Count);
            if (Error == ItemError.RESULT_OK)
            {
                Plr.RemoveMoney((Vendors[Num].Price) * Count);
                foreach (KeyValuePair<UInt16, Item_Info> Kp in Vendors[Num].ItemsReqInfo)
                    Plr.ItmInterface.RemoveItem(Kp.Value.Entry, Kp.Key);
            }
            else if (Error == ItemError.RESULT_MAX_BAG)
            {
                Plr.SendLocalizeString("", GameData.Localized_text.TEXT_MERCHANT_INSUFFICIENT_SPACE_TO_BUY);
            }
            else if (Error == ItemError.RESULT_ITEMID_INVALID)
            {

            }
        }
示例#23
0
        public override void OnInteract(Object Obj, Player Target, InteractMenu Menu)
        {
            // Make sure the player has the quest and hasn't already finished the objectives.
            if (!Target.GetPlayer().QtsInterface.HasQuest(30003) || Target.GetPlayer().QtsInterface.HasFinishQuest(30003))
            {
                return;
            }

            // Spawn the bad npc
            Creature_proto Proto = CreatureService.GetCreatureProto((uint)31);

            if (Proto == null)
            {
                return;
            }

            Obj.UpdateWorldPosition();

            Creature_spawn Spawn = new Creature_spawn();

            Spawn.Guid   = (uint)CreatureService.GenerateCreatureSpawnGUID();
            Proto.Model1 = Obj.GetCreature().Spawn.Proto.Model1;
            Proto.Model2 = Obj.GetCreature().Spawn.Proto.Model2;
            Spawn.BuildFromProto(Proto);
            Spawn.WorldO  = Obj.Heading;
            Spawn.WorldY  = Obj.WorldPosition.Y;
            Spawn.WorldZ  = Obj.WorldPosition.Z;
            Spawn.WorldX  = Obj.WorldPosition.X;
            Spawn.ZoneId  = Obj.Zone.ZoneId;
            Spawn.Faction = 129;

            Creature c = Obj.Region.CreateCreature(Spawn);

            c.EvtInterface.AddEventNotify(EventName.OnDie, RemoveAdds);

            // Remove the old npc
            Obj.Destroy();

            return;
        }
示例#24
0
        static public void F_INTERACT(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            if (cclient.Plr == null || !cclient.Plr.IsInWorld())
            {
                return;
            }

            if (cclient.Plr.IsDead)
            {
                return;
            }

            InteractMenu Menu = new InteractMenu();

            Menu.Unk   = packet.GetUint16();
            Menu.Oid   = packet.GetUint16();
            Menu.Menu  = packet.GetUint16();
            Menu.Page  = packet.GetUint8();
            Menu.Num   = packet.GetUint8();
            Menu.Count = packet.GetUint16();

            Object Obj = cclient.Plr.Region.GetObject(Menu.Oid);

            if (Obj == null)
            {
                return;
            }

            if (Obj.GetDistanceTo(cclient.Plr) > 20)
            {
                //Log.Error("F_INTERACT", "Distance = " + Obj.GetDistanceTo(cclient.Plr));
                return;
            }

            Menu.Packet = packet;
            Obj.SendInteract(cclient.Plr, Menu);
        }
示例#25
0
        public override void SendInteract(Player Plr, InteractMenu Menu)
        {
            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);
                }
            }

            base.SendInteract(Plr, Menu);
        }
示例#26
0
        public void BuyBackItem(InteractMenu Menu)
        {
            UInt16 SlotId = (ushort)(BuyBack.Count - 1 - (Menu.Num + (Menu.Page * 256)));

            UInt16 FreeSlot = GetFreeInventorySlot();
            if (FreeSlot <= 0)
            {
                GetPlayer().SendLocalizeString("", GameData.Localized_text.TEXT_MERCHANT_INSUFFICIENT_SPACE_TO_BUY);
                return;
            }

            Item Itm = GetBuyBack(SlotId, Menu.Count);
            if (Itm == null || !GetPlayer().RemoveMoney(Itm.Count*Itm.Info.SellPrice) )
            {
                GetPlayer().SendLocalizeString("", GameData.Localized_text.TEXT_MERCHANT_INSUFFICIENT_MONEY_TO_BUY);
                return;
            }

            Items[FreeSlot] = Itm;
            Itm.SlotId = FreeSlot;

            SendItems(GetPlayer(), FreeSlot);
            SendBuyBack();
        }
示例#27
0
        public void SellItem(InteractMenu Menu)
        {
            UInt16 SlotId = (UInt16)(Menu.Num + (Menu.Page * 256));
            UInt16 Count = Menu.Count;

            List<UInt16> ToSend = new List<ushort>();
            Item Itm = GetItemInSlot(SlotId);
            if (Itm == null || Itm.Info.SellPrice <= 0)
                return;

            if (Count <= 0 || Count > Itm.Count)
                Count = Itm.Count;

            ToSend.Add(SlotId);

            if (Count == Itm.Count)
            {
                Items[SlotId] = null;
                AddBuyBack(Itm);
            }
            else if (Count < Itm.Count)
            {
                Itm.Count -= Count;

                Item New = new Item(_Owner);
                if (!New.Load(Itm.Info, 0, Count))
                    return;
                AddBuyBack(New);
            }

            GetPlayer().AddMoney((uint)Itm.Info.SellPrice * Count);

            SendItems(GetPlayer(), ToSend);
            SendBuyBack();
        }
示例#28
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);
        }
示例#29
0
文件: Creature.cs 项目: JeFawk/WarEmu
        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);
        }
示例#30
0
        public virtual void OnInteract(Object Obj, Player Target, InteractMenu Menu)
        {

        }
示例#31
0
 public virtual void SendInteract(Player Plr, InteractMenu Menu)
 {
 }
示例#32
0
        public void OnInteract(Object Obj, Player Target, InteractMenu Menu)
        {
            //Log.Info("ScriptsInterface", "OnInteract Scripts : " + Scripts.Count);

            for (int i = 0; i < Scripts.Count; ++i)
                Scripts[i].OnInteract(Obj, Target, Menu);
        }
示例#33
0
        public override void SendInteract(Player Plr, InteractMenu Menu)
        {
            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);   
                }
            }

            base.SendInteract(Plr, Menu);
        }
示例#34
0
文件: Object.cs 项目: JeFawk/WarEmu
 public virtual void SendInteract(Player Plr,InteractMenu Menu)
 {
 }
        public void SendInteract(Player player, InteractMenu menu, Creature crea = null)
        {
            if (Money > 0)
            {
                if (player.PriorityGroup == null)
                {
                    if (player.GldInterface.IsInGuild())
                    {
                        player.GldInterface.ApplyTaxTithe(ref Money);
                    }

                    player.AddMoney(Money);
                }
                else
                {
                    player.PriorityGroup.AddMoney(player, Money);
                }
                Money = 0;
            }

            switch (menu.Menu)
            {
            case 15:     // Closing loot window.
                return;

            case 13:
                TakeAll(player, false);
                if (crea != null && crea.Spawn.Proto.LairBoss == false)
                {
                    crea.IsActive = false;
                }
                break;

            case 12:
                if (TakeLoot(player, menu.Num))
                {
                    ClientUpdateLoot(player);
                }

                if (crea != null && LootCount < 1)
                {
                    if (crea != null && crea.Spawn.Proto.LairBoss == false)
                    {
                        crea.IsActive = false;
                    }
                }
                break;

            default:
                ClientUpdateLoot(player);

                if (crea != null && LootCount < 1)
                {
                    if (crea != null && crea.Spawn.Proto.LairBoss == false)
                    {
                        crea.IsActive = false;
                    }
                }
                break;
            }
        }
示例#36
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);
        }
        public static void F_INTERACT(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            if (cclient.Plr == null || !cclient.Plr.IsInWorld())
            {
                return;
            }

            if (cclient.Plr.IsDead)
            {
                return;
            }

            // don't change anything here or it will brake loot dyes and alot of other stuff !!!!!!!!!!!!!!!!

            InteractMenu Menu = new InteractMenu();

            Menu.Unk  = packet.GetUint16();
            Menu.Oid  = packet.GetUint16();
            Menu.Menu = packet.GetUint16();
            Menu.Page = packet.GetUint8();
            Menu.Num  = packet.GetUint8();
            //ushort unk1 = packet.GetUint16();
            Menu.Count = packet.GetUint16();

            // don't change anything here or it will brake loot dyes and alot of other stuff !!!!!!!!!!!!!!!!

            // loot need greed pass
            if (Menu.Oid == 4207 && cclient.Plr.PriorityGroup != null)
            {
                Menu.Packet = packet;
                cclient.Plr.PriorityGroup.LootVote(cclient.Plr, Menu.Num, Menu.Packet.GetUint16());
            }

            Object Obj = cclient.Plr.Region.GetObject(Menu.Oid);

            if (Obj == null)
            {
                return;
            }

            if (!Obj.AllowInteract(cclient.Plr))
            {
                //Log.Error("F_INTERACT", "Distance = " + Obj.GetDistanceBetweenObjects(cclient.Plr));
                return;
            }

            //this is to prevent double clicking on doors and getting ported back to original clicking position
            if (cclient.Plr.LastInteractTime.HasValue && DateTime.Now.Subtract(cclient.Plr.LastInteractTime.Value).TotalMilliseconds < 500)
            {
                //Log.Error("F_INTERACT", "InteractTime < 1500ms");
                return;
            }

            Menu.Packet = packet;
            Obj.SendInteract(cclient.Plr, Menu);
            if (Obj is GameObject)
            {
                cclient.Plr.LastInteractTime = DateTime.Now;
            }
        }
示例#38
0
 public virtual void SendInteract(Player player, InteractMenu menu)
 {
     ScrInterface.OnInteract(this, player, menu);
     WorldMgr.GeneralScripts.OnWorldPlayerEvent("INTERACT", player, this);
 }
示例#39
0
 public override void OnInteract(Object Obj, Player Target, InteractMenu Menu)
 {
     Mount(Target);
 }
示例#40
0
 public override void OnInteract(Object Obj, Player Target, InteractMenu Menu)
 {
     Mount(Target);
 }
示例#41
0
        public override void OnInteract(Object Obj, Player Target, InteractMenu Menu)
        {
            Log.Debug("MailBox", "OnInteract " + Target.ToString());

            Target.MlInterface.SendMailBox();
        }
示例#42
0
        public override void OnInteract(Object Obj, Player Target, InteractMenu Menu)
        {
            Log.Debug("MailBox", "OnInteract " + Target.ToString());

            Target.MlInterface.SendMailBox();
        }
示例#43
0
文件: Creature.cs 项目: dzikun/WarEmu
        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);
        }
示例#44
0
文件: Unit.cs 项目: dzikun/WarEmu
        public override void SendInteract(Player Plr, InteractMenu Menu)
        {
            if (IsDead && Loots != null)
            {
                Loots.SendInteract(Plr, Menu);
                if (!Loots.IsLootable())
                    SetLootable(false, Plr);
            }

            base.SendInteract(Plr, Menu);
        }
示例#45
0
        public void HandleInteract(Player Plr, Creature Crea, InteractMenu Menu)
        {
            if (Entry == 0)
            {
                return;
            }

            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)
            {
                return;
            }

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

            Out.WriteByte(0);
            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));

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

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

            Out.WritePascalString(Text);
            Out.WriteByte(0);

            Plr.SendPacket(Out);
        }
示例#46
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);
        }
示例#47
0
 public virtual void OnInteract(Object Obj, Player Target, InteractMenu Menu)
 {
 }
示例#48
0
        public void HandleInteract(Player Plr, Creature Crea, InteractMenu Menu)
        {
            if(Entry == 0)
                return;

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

            PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);
            Out.WriteByte(0);
            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) );

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

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

            Out.WritePascalString(Text);
            Out.WriteByte(0);

            Plr.SendPacket(Out);
        }