コード例 #1
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int playerID = 0;
            int slot = 0, itemID = 0;

            stream.Read(out playerID);
            stream.Read(out slot);
            stream.Read(out itemID);

            if (playerID == 0 || !sWorld.VobDict.ContainsKey(playerID))
            {
                throw new Exception("Vob not found!");
            }
            Vob vob = sWorld.VobDict[playerID];

            if (!(vob is NPCProto))
            {
                throw new Exception("Vob is not an NPCProto!");
            }

            Vob  itemVob = null;
            Item item    = null;

            if (itemID != 0)
            {
                sWorld.VobDict.TryGetValue(itemID, out itemVob);
            }
            if (itemVob != null && itemVob is Item)
            {
                item = (Item)itemVob;
            }

            //zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "Set Slot Item 3: " + slot + "; NewItem: " + item + ", " + itemVob + ", " + itemID + ", " + playerID, 0, "NPCProto.Client.cs", 0);
            ((NPCProto)vob).setSlotItem(slot, item);
        }
コード例 #2
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int plID = 0;

            stream.Read(out plID);

            if (plID == 0 || !sWorld.VobDict.ContainsKey(plID))
            {
                throw new Exception("Vob not found!");
            }
            Vob vob = sWorld.VobDict[plID];

            if (!(vob is Player))
            {
                throw new Exception("Vob is not an Player!");
            }

            if (Player.Hero == vob)
            {
                return;
            }

            vob.Despawn();
            sWorld.removeVob(vob);
        }
コード例 #3
0
        public override VobSendFlags Read(RakNet.BitStream stream)
        {
            VobSendFlags sendFlags = base.Read(stream);

            if (sendFlags.HasFlag(VobSendFlags.FocusName))
            {
                stream.Read(out focusName);
            }
            if (sendFlags.HasFlag(VobSendFlags.State))
            {
                stream.Read(out state);
            }
            if (sendFlags.HasFlag(VobSendFlags.UseWithItem))
            {
                int instanceID = 0;
                stream.Read(out instanceID);
                ItemInstance ii = ItemInstance.ItemInstanceDict[instanceID];
                this.useWithItem = ii;
            }
            if (sendFlags.HasFlag(VobSendFlags.TriggerTarget))
            {
                stream.Read(out triggerTarget);
            }

            return(sendFlags);
        }
コード例 #4
0
        public override VobSendFlags Read(RakNet.BitStream stream)
        {
            VobSendFlags b = base.Read(stream);

            if (b.HasFlag(VobSendFlags.MCItemList))
            {
                int itemCount = 0;
                stream.Read(out itemCount);
                for (int i = 0; i < itemCount; i++)
                {
                    int itemID = 0;
                    stream.Read(out itemID);

                    if (!sWorld.VobDict.ContainsKey(itemID))
                    {
                        throw new Exception("Item was not found! :" + itemID);
                    }

                    Item itm = (Item)sWorld.VobDict[itemID];
                    addItem(itm);
                }
            }

            return(b);
        }
コード例 #5
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int   plID     = 0;
            Vec3f position = new Vec3f();
            bool  enabled  = false;

            stream.Read(out plID);
            stream.Read(out position);
            stream.Read(out enabled);


            if (plID == 0 || !sWorld.VobDict.ContainsKey(plID))
            {
                throw new Exception("Vob not found! " + plID);
            }
            Vob vob = sWorld.VobDict[plID];

            if (!(vob is NPCProto))
            {
                throw new Exception("Vob is not an NPC!");
            }

            //zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "Enable: "+enabled, 0, "Program.cs", 0);

            if (enabled)
            {
                ((NPCProto)vob).Enable(position);
            }
            else
            {
                ((NPCProto)vob).Disable();
            }
        }
コード例 #6
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int playerID   = 0;
            int weaponMode = 0;

            stream.Read(out playerID);
            stream.Read(out weaponMode);

            if (playerID == 0 || !sWorld.VobDict.ContainsKey(playerID))
            {
                throw new Exception("Vob not found!");
            }
            Vob vob = sWorld.VobDict[playerID];

            if (!(vob is NPCProto))
            {
                throw new Exception("Vob is not an NPCProto!");
            }

            ((NPCProto)vob).WeaponMode = weaponMode;

            if (vob.Address != 0)
            {
                ((NPCProto)vob).setWeaponMode(weaponMode);
            }
        }
コード例 #7
0
ファイル: Zip.cs プロジェクト: Arkasian/GothicUntoldChapter
        public static void Decompress(RakNet.BitStream source, RakNet.BitStream dest)
        {
            int len = 0;

            source.Read(out len);
            byte[] arr = new byte[len];
            source.Read(arr, (uint)len);



            MemoryStream input = new MemoryStream();

            input.Write(arr, 0, len);

            MemoryStream output = new MemoryStream();

            Decompress(input, output);


            arr = output.ToArray();

            dest.Reset();
            dest.Write(arr, (uint)arr.Length);
            output.Close();
            output.Dispose();
        }
コード例 #8
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int  day = 0;
            byte hour = 0, minute = 0;

            stream.Read(out day);
            stream.Read(out hour);
            stream.Read(out minute);

            sWorld.Day    = day;
            sWorld.Hour   = hour;
            sWorld.Minute = minute;

            if (!(Program._state is GUC.States.GameState))
            {
                return;
            }

            Process process = Process.ThisProcess();

            oCGame.Game(process).WorldTimer.SetDay(day);
            oCGame.Game(process).WorldTimer.SetTime(hour, minute);

            if (sWorld.WeatherType != 2)
            {
                oCGame.Game(process).World.SkyControlerOutdoor.SetWeatherType(sWorld.WeatherType);
            }
            oCGame.Game(process).World.SkyControlerOutdoor.setRainTime(sWorld.StartRainHour, sWorld.StartRainMinute, sWorld.EndRainHour, sWorld.EndRainMinute);
        }
コード例 #9
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            Process process = Process.ThisProcess();
            //oCNpc npc = oCNpc.Player(process);
            //Player.Hero.Attributes[(int)NPCAttributeFlags.ATR_HITPOINTS] = 1;



            float length   = 0;
            int   playerID = 0;

            stream.Read(out playerID);
            stream.Read(out length);

            if (!sWorld.VobDict.ContainsKey(playerID))
            {
                throw new Exception("PlayerID: " + playerID + " was not found!");
            }
            NPCProto proto = (NPCProto)sWorld.VobDict[playerID];

            proto.Attributes[(int)NPCAttribute.ATR_HITPOINTS] = 1;

            if (proto.IsSpawned)
            {
                oCNpc npc = new oCNpc(process, proto.Address);
                npc.DropUnconscious(length, new oCNpc(process, 0));
            }
        }
コード例 #10
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int   playerID = 0;
            Vec3f scale    = new Vec3f();

            stream.Read(out playerID);
            stream.Read(out scale);

            if (playerID == 0 || !sWorld.VobDict.ContainsKey(playerID))
            {
                throw new Exception("Vob not found!");
            }
            Vob vob = sWorld.VobDict[playerID];

            if (!(vob is NPCProto))
            {
                throw new Exception("Vob is not an NPCProto!");
            }

            ((NPCProto)vob).Scale = scale;

            if (vob.Address != 0)
            {
                ((NPCProto)vob).setScale(scale);
            }
        }
コード例 #11
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            Spell ii = new Spell();

            ii.Read(stream);
            Spell.addItemInstance(ii);
        }
コード例 #12
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int plID = 0;

            stream.Read(out plID);

            if (plID == 0 || !sWorld.VobDict.ContainsKey(plID))
            {
                throw new Exception("Vob not found!");
            }
            Vob vob = sWorld.VobDict[plID];

            if (!(vob is NPCProto))
            {
                throw new Exception("Vob is not an NPC!");
            }

            if (vob.Address == 0)
            {
                return;
            }

            Process process = Process.ThisProcess();
            oCNpc   npc     = new oCNpc(process, vob.Address);
            //npc.StartDialogAni();
            zString str = zString.Create(process, "T_DIALOGGESTURE_09");

            npc.GetModel().StartAnimation(str);
            str.Dispose();

            zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "npc StartDialog: " + vob.Address, 0, "Client.cs", 0);
        }
コード例 #13
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int  plID, value;
            byte attribType;

            stream.Read(out plID);
            stream.Read(out attribType);
            stream.Read(out value);

            if (plID == 0 || !sWorld.VobDict.ContainsKey(plID))
            {
                throw new Exception("Vob not found!");
            }
            Vob vob = sWorld.VobDict[plID];

            if (!(vob is NPCProto))
            {
                throw new Exception("Vob is not an NPC!");
            }

            NPCProto proto = (NPCProto)vob;

            proto.Attributes[attribType] = value;

            if (vob.Address == 0)
            {
                return;
            }

            Process process = Process.ThisProcess();
            oCNpc   npc     = new oCNpc(process, vob.Address);

            npc.setAttributes(attribType, value);
        }
コード例 #14
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int plID = 0;

            stream.Read(out plID);

            if (plID == 0 || !sWorld.VobDict.ContainsKey(plID))
            {
                throw new Exception("Vob not found!");
            }
            Vob vob = sWorld.VobDict[plID];

            if (!(vob is NPCProto))
            {
                throw new Exception("Vob is not an NPC!");
            }

            if (vob.Address == 0)
            {
                return;
            }
            Process process = Process.ThisProcess();
            oCNpc   npc     = new oCNpc(process, vob.Address);

            zVec3 pos = npc.GetPosition();

            npc.ResetPos(pos);
            pos.Dispose();
        }
コード例 #15
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            ItemInstance ii = new ItemInstance();

            ii.Read(stream);
            ItemInstance.addItemInstance(ii);
        }
コード例 #16
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int   playerID = 0;
            float fatness  = 1f;

            stream.Read(out playerID);
            stream.Read(out fatness);

            if (playerID == 0 || !sWorld.VobDict.ContainsKey(playerID))
            {
                throw new Exception("Vob not found!");
            }
            Vob vob = sWorld.VobDict[playerID];

            if (!(vob is NPCProto))
            {
                throw new Exception("Vob is not an NPCProto!");
            }

            ((NPCProto)vob).Fatness = fatness;

            if (vob.Address != 0)
            {
                ((NPCProto)vob).setFatness(fatness);
            }
        }
コード例 #17
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int casterID = 0, targetID = 0, spellID = 0, itemID = 0;

            stream.Read(out itemID);
            stream.Read(out casterID);
            stream.Read(out targetID);
            stream.Read(out spellID);


            Vob  itemVob = null;
            Item item    = null;

            Vob   casterVob = null;
            Spell spell     = null;

            NPCProto caster = null;
            Vob      target = null;

            sWorld.VobDict.TryGetValue(casterID, out casterVob);
            sWorld.VobDict.TryGetValue(itemID, out itemVob);

            if (casterVob == null)
            {
                throw new Exception("Caster was not found!");
            }
            if (!(casterVob is NPCProto))
            {
                throw new Exception("Caster was not a npcproto " + casterVob);
            }
            caster = (NPCProto)casterVob;
            if (targetID != 0)
            {
                sWorld.VobDict.TryGetValue(targetID, out target);
            }

            Spell.SpellDict.TryGetValue(spellID, out spell);
            if (spell == null)
            {
                throw new Exception("Spell can not be null!");
            }



            if (caster.Address == 0)
            {
                return;
            }
            Process process = Process.ThisProcess();
            oCNpc   npc     = new oCNpc(process, caster.Address);

            if (target != null)
            {
                npc.MagBook.Spell_Setup(npc, new zCVob(process, target.Address), 0);
            }
            //npc.MagBook.GetSelectedSpell().Target = new zCVob(process, target.Address);
            npc.MagBook.SpellCast();

            zERROR.GetZErr(process).Report(2, 'G', "Cast Spell! 2 ", 0, "Program.cs", 0);
        }
コード例 #18
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            String video = "";

            stream.Read(out video);

            CGameManager.GameManager(Process.ThisProcess()).PlayVideo(video);
        }
コード例 #19
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            bool freeze = false;

            stream.Read(out freeze);
            oCNpc.Freeze(Process.ThisProcess(), freeze);

            zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "Player Freeze: " + freeze, 0, "Program.cs", 0);
        }
コード例 #20
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int  playerID = 0, itemID = 0;
            bool equip = false;

            stream.Read(out playerID);
            stream.Read(out itemID);
            stream.Read(out equip);

            NPCProto player = (NPCProto)sWorld.VobDict[playerID];
            Item     item   = (Item)sWorld.VobDict[itemID];

            if (equip)
            {
                if (item.ItemInstance.MainFlags.HasFlag(MainFlags.ITEM_KAT_ARMOR))
                {
                    player.Armor = item;
                }
                else if (item.ItemInstance.MainFlags.HasFlag(MainFlags.ITEM_KAT_NF))
                {
                    player.Weapon = item;
                }
                else if (item.ItemInstance.MainFlags.HasFlag(MainFlags.ITEM_KAT_FF))
                {
                    player.RangeWeapon = item;
                }

                player.EquippedList.Add(item);
                if (player.Address != 0)
                {
                    hNpc.blockSendEquip = true;
                    new oCNpc(Process.ThisProcess(), player.Address).Equip(new oCItem(Process.ThisProcess(), item.Address));
                }
            }
            else
            {
                if (item.ItemInstance.MainFlags.HasFlag(MainFlags.ITEM_KAT_ARMOR))
                {
                    player.Armor = null;
                }
                else if (item.ItemInstance.MainFlags.HasFlag(MainFlags.ITEM_KAT_NF))
                {
                    player.Weapon = null;
                }
                else if (item.ItemInstance.MainFlags.HasFlag(MainFlags.ITEM_KAT_FF))
                {
                    player.RangeWeapon = null;
                }
                player.EquippedList.Remove(item);
                if (player.Address != 0)
                {
                    hNpc.blockSendUnEquip = true;
                    new oCNpc(Process.ThisProcess(), player.Address).UnequipItem(new oCItem(Process.ThisProcess(), item.Address));
                }
            }
        }
コード例 #21
0
ファイル: Zip.cs プロジェクト: Arkasian/GothicUntoldChapter
        public static void Compress(Stream source, RakNet.BitStream dest)
        {
            MemoryStream ms = new MemoryStream();

            Compress(source, ms);

            byte[] arr = ms.ToArray();
            dest.Write(arr.Length);
            dest.Write(arr, (uint)arr.Length);
        }
コード例 #22
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int itemID = 0, amount = 0;

            stream.Read(out itemID);
            stream.Read(out amount);

            if (itemID == 0 || !sWorld.VobDict.ContainsKey(itemID))
            {
                throw new Exception("Vob not found!");
            }
            Vob vob = sWorld.VobDict[itemID];

            if (!(vob is Item))
            {
                throw new Exception("Vob is not an Item!");
            }

            Item item = (Item)vob;

            item.Amount = amount;


            zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "Item-Change-Amount message!", 0, "Program.cs", 0);

            if (item.Address != 0)
            {
                Process process = Process.ThisProcess();
                oCItem  gI      = new oCItem(process, item.Address);


                if (item.Amount <= 0)
                {
                    if (item.Container is NPCProto)
                    {
                        new oCNpc(process, ((NPCProto)item.Container).Address).RemoveFromInv(gI, gI.Amount);
                    }
                    else if (item.Container is MobContainer)
                    {
                        new oCMobContainer(process, ((MobContainer)item.Container).Address).Remove(gI, gI.Amount);
                    }
                    else if (item.Container is World)
                    {
                        oCGame.Game(process).World.RemoveVob(gI);
                    }
                }

                gI.Amount = item.Amount;
            }

            if (item.Amount <= 0)
            {
                sWorld.removeVob(item);
            }
        }
コード例 #23
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int    vobID = 0, targetID = 0, effectLevel = 0, damage = 0, damageType = 0;
            bool   isProjectile = false;
            String effect       = "";

            stream.Read(out vobID);
            stream.Read(out effect);
            stream.Read(out targetID);
            stream.Read(out effectLevel);
            stream.Read(out damage);
            stream.Read(out damageType);
            stream.Read(out isProjectile);


            Vob vob = null;

            sWorld.VobDict.TryGetValue(vobID, out vob);
            if (vob == null)
            {
                throw new Exception("Vob was not found: " + vobID);
            }

            Vob targetVob = null;

            if (vobID != 0)
            {
                sWorld.VobDict.TryGetValue(targetID, out targetVob);
                if (targetVob == null)
                {
                    throw new Exception("Target-Vob was not found: " + vobID);
                }
            }

            if (vob.Address == 0 || !vob.IsSpawned)
            {
                return;
            }
            Process process    = Process.ThisProcess();
            zCVob   gVob       = new zCVob(process, vob.Address);
            zCVob   gTargetVob = null;

            if (targetVob != null && targetVob.Address != 0 && targetVob.IsSpawned)
            {
                gTargetVob = new zCVob(process, targetVob.Address);
            }
            else
            {
                gTargetVob = new zCVob(process, 0);
            }


            using (zString str = zString.Create(process, effect))
                oCVisualFX.CreateAndPlay(process, str, gVob, gTargetVob, effectLevel, damage, damageType, isProjectile ? 1 : 0);
        }
コード例 #24
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int itemID, containerID;

            stream.Read(out itemID);
            stream.Read(out containerID);

            if (!sWorld.VobDict.ContainsKey(itemID))
            {
                throw new Exception("ItemID was not found!: " + itemID);
            }
            if (!sWorld.VobDict.ContainsKey(containerID))
            {
                throw new Exception("ContainerID was not found!: " + itemID);
            }

            Vob itemVob      = sWorld.VobDict[itemID];
            Vob containerVob = sWorld.VobDict[containerID];

            if (!(itemVob is Item))
            {
                throw new Exception("ItemVob is not an Item! " + itemVob);
            }
            if (!(containerVob is IContainer))
            {
                throw new Exception("Container is not an IContainer! " + containerVob);
            }

            Item       item      = (Item)itemVob;
            IContainer container = (IContainer)containerVob;

            if (item.Container is MobContainer)
            {
                MobContainer itC = (MobContainer)item.Container;
                if (itC.Address != 0)
                {
                    new oCMobContainer(Process.ThisProcess(), itC.Address).Remove(new oCItem(Process.ThisProcess(), item.Address));
                }
            }
            else if (item.Container is NPCProto)
            {
                NPCProto itC = (NPCProto)item.Container;
                if (itC.Address != 0)
                {
                    new oCNpc(Process.ThisProcess(), itC.Address).RemoveFromInv(new oCItem(Process.ThisProcess(), item.Address), item.Amount);
                }
            }

            container.addItem(item);

            zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "Item-Change-Container message!", 0, "Program.cs", 0);
        }
コード例 #25
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int vobID = 0;

            stream.Read(out vobID);

            if (vobID == 0 || !sWorld.VobDict.ContainsKey(vobID))
            {
                throw new Exception("Vob not found!");
            }
            Vob vob = sWorld.VobDict[vobID];

            sWorld.getWorld(vob.Map).removeVob(vob);
            vob.Despawn();
        }
コード例 #26
0
        public override Vob.VobSendFlags Write(RakNet.BitStream stream)
        {
            VobSendFlags b = base.Write(stream);

            if (b.HasFlag(VobSendFlags.MCItemList))
            {
                stream.Write(this.itemList.Count);
                for (int i = 0; i < this.itemList.Count; i++)
                {
                    stream.Write(this.itemList[i].ID);
                }
            }

            return(b);
        }
コード例 #27
0
ファイル: Zip.cs プロジェクト: Arkasian/GothicUntoldChapter
        public static void Decompress(RakNet.BitStream source, Stream dest)
        {
            int len = 0;

            source.Read(out len);
            byte[] arr = new byte[len];
            source.Read(arr, (uint)len);



            MemoryStream input = new MemoryStream();

            input.Write(arr, 0, len);

            Decompress(input, dest);
        }
コード例 #28
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int vobType = 0;

            stream.Read(out vobType);

            Vob v = Vob.createVob((VobType)vobType);

            if (v == null)
            {
                throw new Exception("Vobtype was not known in Vob.createVob: " + vobType);
            }
            v.Read(stream);

            sWorld.addVob(v);
        }
コード例 #29
0
ファイル: Zip.cs プロジェクト: Arkasian/GothicUntoldChapter
        public static void Compress(RakNet.BitStream source, int offset, RakNet.BitStream dest)
        {
            MemoryStream ms  = new MemoryStream();
            MemoryStream sms = new MemoryStream();

            byte[] sData = source.GetData();
            sms.Write(sData, offset, sData.Length - offset);

            Compress(sms, ms);
            sms.Close();
            sms.Dispose();

            byte[] arr = ms.ToArray();
            dest.Write(arr.Length);
            dest.Write(arr, (uint)arr.Length);
        }
コード例 #30
0
        public void Read(RakNet.BitStream stream, RakNet.Packet packet, Client client)
        {
            int   vobID = 0;
            Vec3f dir;

            stream.Read(out vobID);
            stream.Read(out dir);

            if (vobID == 0 || !sWorld.VobDict.ContainsKey(vobID))
            {
                throw new Exception("Vob not found!");
            }
            Vob vob = sWorld.VobDict[vobID];

            vob.setDirection(dir);
        }