Example #1
0
 public override void Clear()
 {
     this.Index_ = null;
     this.MagicType_ = null;
     this.Element_ = null;
     this.ValidTargets_ = null;
     this.Skill_ = null;
     this.MPCost_ = null;
     this.CastingTime_ = null;
     this.RecastDelay_ = null;
     this.LevelRequired_ = null;
     this.ID_ = null;
     this.ListIconID_ = null;
     this.Unknown1_ = null;
     this.Unknown2_ = null;
     //            this.Unknown3_ = null;
     //            this.Unknown4_ = null;
 }
Example #2
0
 public override void Clear()
 {
     this.Index_               = null;
       this.MagicType_           = null;
       this.Element_             = null;
       this.ValidTargets_        = null;
       this.Skill_               = null;
       this.MPCost_              = null;
       this.CastingTime_         = null;
       this.RecastDelay_         = null;
       this.LevelRequired_       = null;
       this.ID_                  = null;
       this.ListIconID_          = null;
       this.JapaneseName_        = null;
       this.EnglishName_         = null;
       this.JapaneseDescription_ = null;
       this.EnglishDescription_  = null;
 }
Example #3
0
 public override sealed void Clear()
 {
     Index_ = null;
     MagicType_ = null;
     Element_ = null;
     ValidTargets_ = null;
     Skill_ = null;
     MPCost_ = null;
     CastingTime_ = null;
     RecastDelay_ = null;
     LevelRequired_ = null;
     ID_ = null;
     ListIconID_ = null;
     Unknown1_ = null;
     Unknown2_ = null;
     Unknown3_ = null;
     Unknown4_ = null;
 }
Example #4
0
        protected override void LoadField(string Field, System.Xml.XmlElement Node)
        {
            switch (Field)
            {
            // "Simple" Fields
            case "casting-time":   this.CastingTime_ = (byte)this.LoadUnsignedIntegerField(Node); break;

            case "element":        this.Element_ = (Element)this.LoadHexField(Node); break;

            case "list-icon-id":   this.ListIconID_ = (byte)this.LoadUnsignedIntegerField(Node); break;

            case "id":             this.ID_ = (ushort)this.LoadUnsignedIntegerField(Node); break;

            case "index":          this.Index_ = (ushort)this.LoadUnsignedIntegerField(Node); break;

            case "level-required": this.LevelRequired_ = this.LoadByteArray(Node); break;

            case "magic-type":     this.MagicType_ = (MagicType)this.LoadHexField(Node); break;

            case "mp-cost":        this.MPCost_ = (ushort)this.LoadUnsignedIntegerField(Node); break;

            case "recast-delay":   this.RecastDelay_ = (ushort)this.LoadUnsignedIntegerField(Node); break;

            case "skill":          this.Skill_ = (Skill)this.LoadHexField(Node); break;

            case "unknown-1":      this.Unknown1_ = (byte)this.LoadUnsignedIntegerField(Node); break;

            case "unknown-2":      this.Unknown2_ = (byte)this.LoadUnsignedIntegerField(Node); break;

            case "unknown-3":      this.Unknown3_ = (byte)this.LoadUnsignedIntegerField(Node); break;

            case "unknown-4":      this.Unknown4_ = (byte)this.LoadUnsignedIntegerField(Node); break;

            case "valid-targets":  this.ValidTargets_ = (ValidTarget)this.LoadHexField(Node); break;
            }
        }
Example #5
0
 protected override void LoadField(string Field, System.Xml.XmlElement Node)
 {
     switch (Field)
     {
         // "Simple" Fields
         case "activation-time":
             this.ActivationTime_ = (ushort)this.LoadUnsignedIntegerField(Node);
             break;
         case "casting-time":
             this.CastingTime_ = (byte)this.LoadUnsignedIntegerField(Node);
             break;
         case "damage":
             this.Damage_ = (ushort)this.LoadUnsignedIntegerField(Node);
             break;
         case "delay":
             this.Delay_ = (short)this.LoadSignedIntegerField(Node);
             break;
         case "description":
             this.Description_ = this.LoadTextField(Node);
             break;
         case "dps":
             this.DPS_ = (ushort)this.LoadUnsignedIntegerField(Node);
             break;
         case "element":
             this.Element_ = (Element)this.LoadHexField(Node);
             break;
         case "element-charge":
             this.ElementCharge_ = (uint)this.LoadUnsignedIntegerField(Node);
             break;
         case "flags":
             this.Flags_ = (ItemFlags)this.LoadHexField(Node);
             break;
         case "id":
             this.ID_ = (uint)this.LoadUnsignedIntegerField(Node);
             break;
         case "iLevel:":
             this.iLevel_ = (ushort)this.LoadUnsignedIntegerField(Node);
             break;
         case "instinct-cost:":
             this.iLevel_ = (ushort)this.LoadUnsignedIntegerField(Node);
             break;
         case "jobs":
             this.Jobs_ = (Job)this.LoadHexField(Node);
             break;
         case "jug-size":
             this.JugSize_ = (byte)this.LoadUnsignedIntegerField(Node);
             break;
         case "level":
             this.Level_ = (ushort)this.LoadUnsignedIntegerField(Node);
             break;
         case "log-name-plural":
             this.LogNamePlural_ = this.LoadTextField(Node);
             break;
         case "log-name-singular":
             this.LogNameSingular_ = this.LoadTextField(Node);
             break;
         case "max-charges":
             this.MaxCharges_ = (byte)this.LoadUnsignedIntegerField(Node);
             break;
         case "name":
             this.Name_ = this.LoadTextField(Node);
             break;
         case "puppet-slot":
             this.PuppetSlot_ = (PuppetSlot)this.LoadHexField(Node);
             break;
         case "races":
             this.Races_ = (Race)this.LoadHexField(Node);
             break;
         case "resource-id":
             this.ResourceID_ = (ushort)this.LoadUnsignedIntegerField(Node);
             break;
         case "reuse-delay":
             this.ReuseDelay_ = (uint)this.LoadUnsignedIntegerField(Node);
             break;
         case "superior-level":
             this.SuperiorLevel_ = (ushort)this.LoadUnsignedIntegerField(Node);
             break;
         case "shield-size":
             this.ShieldSize_ = (ushort)this.LoadUnsignedIntegerField(Node);
             break;
         case "skill":
             this.Skill_ = (Skill)this.LoadHexField(Node);
             break;
         case "slots":
             this.Slots_ = (EquipmentSlot)this.LoadHexField(Node);
             break;
         case "stack-size":
             this.StackSize_ = (ushort)this.LoadUnsignedIntegerField(Node);
             break;
         case "storage-slots":
             this.StorageSlots_ = (int)this.LoadSignedIntegerField(Node);
             break;
         case "type":
             this.Type_ = (ItemType)this.LoadHexField(Node);
             break;
         case "unknown-1":
             this.Unknown1_ = (uint)this.LoadUnsignedIntegerField(Node);
             break;
         case "unknown-2":
             this.Unknown2_ = (ushort)this.LoadUnsignedIntegerField(Node);
             break;
         case "unknown-3":
             this.Unknown3_ = (uint)this.LoadUnsignedIntegerField(Node);
             break;
         case "unknown-4":
             this.Unknown4_ = (uint)this.LoadUnsignedIntegerField(Node);
             break;
         case "use-delay":
             this.UseDelay_ = (ushort)this.LoadUnsignedIntegerField(Node);
             break;
         case "valid-targets":
             this.ValidTargets_ = (ValidTarget)this.LoadHexField(Node);
             break;
         // Sub-Things
         case "icon":
             if (this.Icon_ == null)
             {
                 this.Icon_ = new Graphic();
             }
             this.LoadThingField(Node, this.Icon_);
             break;
     }
 }
Example #6
0
 public override void Clear()
 {
     if (this.Icon_ != null)
     {
         this.Icon_.Clear();
     }
     this.ID_ = null;
     this.Flags_ = null;
     this.StackSize_ = null;
     this.Type_ = null;
     this.ResourceID_ = null;
     this.ValidTargets_ = null;
     this.Name_ = null;
     this.Description_ = null;
     this.LogNameSingular_ = null;
     this.LogNamePlural_ = null;
     this.Element_ = null;
     this.StorageSlots_ = null;
     this.ActivationTime_ = null;
     this.Level_ = null;
     this.Slots_ = null;
     this.Races_ = null;
     this.Jobs_ = null;
     this.SuperiorLevel_ = null;
     this.ShieldSize_ = null;
     this.Damage_ = null;
     this.Delay_ = null;
     this.DPS_ = null;
     this.Skill_ = null;
     this.JugSize_ = null;
     this.iLevel_ = null;
     this.MaxCharges_ = null;
     this.CastingTime_ = null;
     this.UseDelay_ = null;
     this.ReuseDelay_ = null;
     this.PuppetSlot_ = null;
     this.ElementCharge_ = null;
     this.InstinctCost_ = null;
     this.Icon_ = null;
     this.Unknown1_ = null;
     this.Unknown2_ = null;
     this.Unknown3_ = null;
     this.Unknown4_ = null;
 }
Example #7
0
    public void TriggerLatentEvent(Player player, string eventName, Resource sourceResource, Element?source = null, int rate = 50000, params LuaValue[] parameters)
    {
        var packet = new LuaEventPacket(eventName, (source ?? this.root).Id, parameters);

        this.latentPacketService.EnqueueLatentPacket(new Player[] { player }, packet, sourceResource.NetId, rate);
    }
Example #8
0
 public void TriggerEvent(string eventName, Element?source = null, params LuaValue[] parameters)
 {
     this.server.BroadcastPacket(new LuaEventPacket(eventName, (source ?? this.root).Id, parameters));
 }
Example #9
0
 public void TriggerEventFor(Player player, string eventName, Element?source = null, params object[] parameters)
 {
     TriggerEventFor(player, eventName, source, parameters.Select(x => this.mapper.Map(x)).ToArray());
 }
Example #10
0
 protected override void LoadField(string Field, System.Xml.XmlElement Node)
 {
     switch (Field) {
     // "Simple" Fields
     case "casting-time":         this.CastingTime_         = (byte)        this.LoadUnsignedIntegerField(Node); break;
     case "element":              this.Element_             = (Element)     this.LoadHexField            (Node); break;
     case "english-description":  this.EnglishDescription_  =               this.LoadTextField           (Node); break;
     case "english-name":         this.EnglishName_         =               this.LoadTextField           (Node); break;
     case "id":                   this.ID_                  = (ushort)      this.LoadUnsignedIntegerField(Node); break;
     case "index":                this.Index_               = (ushort)      this.LoadUnsignedIntegerField(Node); break;
     case "japanese-description": this.JapaneseDescription_ =               this.LoadTextField           (Node); break;
     case "japanese-name":        this.JapaneseName_        =               this.LoadTextField           (Node); break;
     case "level-required":       this.LevelRequired_       =               this.LoadByteArray           (Node); break;
     case "list-icon-id":         this.ListIconID_          = (byte)        this.LoadUnsignedIntegerField(Node); break;
     case "magic-type":           this.MagicType_           = (MagicType)   this.LoadHexField            (Node); break;
     case "mp-cost":              this.MPCost_              = (ushort)      this.LoadUnsignedIntegerField(Node); break;
     case "recast-delay":         this.RecastDelay_         = (ushort)      this.LoadUnsignedIntegerField(Node); break;
     case "skill":                this.Skill_               = (Skill)       this.LoadHexField            (Node); break;
     case "valid-targets":        this.ValidTargets_        = (ValidTarget) this.LoadHexField            (Node); break;
       }
 }
Example #11
0
 public void TriggerLatentEventForMany(IEnumerable <Player> players, string eventName, Resource sourceResource, Element?source = null, int rate = 50000)
 {
     TriggerLatentEventForMany(players, eventName, sourceResource, source, rate, Array.Empty <LuaValue>());
 }
Example #12
0
        // Block Layout:
        // 000-001 U16 Index
        // 002-003 U16 Magic Type (1/2/3/4/5/6 - White/Black/Summon/Ninja/Bard/Blue)
        // 004-005 U16 Element
        // 006-007 U16 Valid Targets
        // 008-009 U16 Skill
        // 00a-00b U16 MP Cost
        // 00c-00c U8  Cast Time (1/4 second)
        // 00d-00d U8  Recast Delay (1/4 second)
        // 00e-025 U8  Level required (1 byte per job, 0xff if not learnable; first is for the NUL job, so always 0xff; only 24 slots despite 32 possible job flags)
        // 026-027 U16 ID (0 for "unused" spells; starts out equal to the index, but doesn't stay that way)
        // 028-028 U8  List Icon ID (not sure what this is an index of, but it seems to match differences in item icon)
        // 029-029 U8  Unknown #1
        // 02a-02b U8  Unknown #2
        // 02c-02d U8  Unknown #3
        // 02e-02f U8  Unknown #4
        // 030-03e U8  Padding (NULs)
        // 03f-03f U8  End marker (0xff)
        public bool Read(BinaryReader BR)
        {
            Clear();
            try
            {
                var Bytes = BR.ReadBytes(0x64);
                if (Bytes[0x3] != 0x00 || Bytes[0x5] != 0x00 || Bytes[0x7] != 0x00 || Bytes[0x9] != 0x00 || Bytes[0xE] != 0xFF || Bytes[0x63] != 0xFF)
                {
                    return false;
                }
                if (!FFXIEncryption.DecodeDataBlockMask(Bytes))
                {
                    return false;
                }
                BR = new BinaryReader(new MemoryStream(Bytes, false));
            }
            catch
            {
                return false;
            }
            Index_ = BR.ReadUInt16();
            MagicType_ = (MagicType)BR.ReadUInt16();
            Element_ = (Element)BR.ReadUInt16();
            ValidTargets_ = (ValidTarget)BR.ReadUInt16();
            Skill_ = (Skill)BR.ReadUInt16();
            MPCost_ = BR.ReadUInt16();
            CastingTime_ = BR.ReadByte();
            RecastDelay_ = BR.ReadByte();
            LevelRequired_ = new int[0x18];
            for (var i = 0; i < 0x18; ++i)
            {
                LevelRequired_[i] = BR.ReadInt16();
            }
            ID_ = BR.ReadUInt16();
            ListIconID_ = BR.ReadByte();
            Unknown1_ = BR.ReadByte();
            Unknown2_ = BR.ReadByte();
            Unknown3_ = BR.ReadByte();
            Unknown4_ = BR.ReadByte();
            Unknown5_ = BR.ReadUInt32();

            #if DEBUG // Check the padding bytes for unexpected data
            for (byte i = 0; i < 26; ++i)
            {
                var PaddingByte = BR.ReadByte();
                if (PaddingByte != 0)
                {
                    Console.WriteLine("SpellInfo2: Entry #{0}: Padding Byte #{1} is non-zero: {2:X2} ({2})", Index_, i + 1, PaddingByte);
                }
            }
            #endif
            BR.Close();
            return true;
        }
Example #13
0
 public void TriggerLatentEvent(string eventName, Resource sourceResource, Element?source = null, int rate = 50000)
 {
     TriggerLatentEvent(eventName, sourceResource, source, rate, Array.Empty <LuaValue>());
 }
Example #14
0
 public void TriggerLatentEvent(string eventName, Resource sourceResource, Element?source = null, int rate = 50000, params object[] parameters)
 {
     TriggerLatentEvent(eventName, sourceResource, source, rate, parameters.Select(x => this.mapper.Map(x)).ToArray());
 }
Example #15
0
 public void TriggerEventForMany(IEnumerable <Player> players, string eventName, Element?source = null)
 {
     TriggerEventForMany(players, eventName, source, Array.Empty <LuaValue>());
 }
Example #16
0
 public void TriggerEventForMany(IEnumerable <Player> players, string eventName, Element?source = null, params object[] parameters)
 {
     TriggerEventForMany(players, eventName, source, parameters.Select(x => this.mapper.Map(x)).ToArray());
 }
Example #17
0
 public void TriggerEventFor(Player player, string eventName, Element?source = null)
 {
     TriggerEventFor(player, eventName, source, Array.Empty <LuaValue>());
 }
Example #18
0
        protected override void LoadField(string Field, System.Xml.XmlElement Node)
        {
            switch (Field)
            {
            // "Simple" Fields
            case "activation-time":
                this.ActivationTime_ = (ushort)this.LoadUnsignedIntegerField(Node);
                break;

            case "casting-time":
                this.CastingTime_ = (byte)this.LoadUnsignedIntegerField(Node);
                break;

            case "damage":
                this.Damage_ = (ushort)this.LoadUnsignedIntegerField(Node);
                break;

            case "delay":
                this.Delay_ = (short)this.LoadSignedIntegerField(Node);
                break;

            case "description":
                this.Description_ = this.LoadTextField(Node);
                break;

            case "dps":
                this.DPS_ = (ushort)this.LoadUnsignedIntegerField(Node);
                break;

            case "element":
                this.Element_ = (Element)this.LoadHexField(Node);
                break;

            case "element-charge":
                this.ElementCharge_ = (uint)this.LoadUnsignedIntegerField(Node);
                break;

            case "flags":
                this.Flags_ = (ItemFlags)this.LoadHexField(Node);
                break;

            case "id":
                this.ID_ = (uint)this.LoadUnsignedIntegerField(Node);
                break;

            case "iLevel:":
                this.iLevel_ = (ushort)this.LoadUnsignedIntegerField(Node);
                break;

            case "instinct-cost:":
                this.iLevel_ = (ushort)this.LoadUnsignedIntegerField(Node);
                break;

            case "jobs":
                this.Jobs_ = (Job)this.LoadHexField(Node);
                break;

            case "jug-size":
                this.JugSize_ = (byte)this.LoadUnsignedIntegerField(Node);
                break;

            case "level":
                this.Level_ = (ushort)this.LoadUnsignedIntegerField(Node);
                break;

            case "log-name-plural":
                this.LogNamePlural_ = this.LoadTextField(Node);
                break;

            case "log-name-singular":
                this.LogNameSingular_ = this.LoadTextField(Node);
                break;

            case "max-charges":
                this.MaxCharges_ = (byte)this.LoadUnsignedIntegerField(Node);
                break;

            case "name":
                this.Name_ = this.LoadTextField(Node);
                break;

            case "puppet-slot":
                this.PuppetSlot_ = (PuppetSlot)this.LoadHexField(Node);
                break;

            case "races":
                this.Races_ = (Race)this.LoadHexField(Node);
                break;

            case "resource-id":
                this.ResourceID_ = (ushort)this.LoadUnsignedIntegerField(Node);
                break;

            case "reuse-delay":
                this.ReuseDelay_ = (uint)this.LoadUnsignedIntegerField(Node);
                break;

            case "superior-level":
                this.SuperiorLevel_ = (ushort)this.LoadUnsignedIntegerField(Node);
                break;

            case "shield-size":
                this.ShieldSize_ = (ushort)this.LoadUnsignedIntegerField(Node);
                break;

            case "skill":
                this.Skill_ = (Skill)this.LoadHexField(Node);
                break;

            case "slots":
                this.Slots_ = (EquipmentSlot)this.LoadHexField(Node);
                break;

            case "stack-size":
                this.StackSize_ = (ushort)this.LoadUnsignedIntegerField(Node);
                break;

            case "storage-slots":
                this.StorageSlots_ = (int)this.LoadSignedIntegerField(Node);
                break;

            case "type":
                this.Type_ = (ItemType)this.LoadHexField(Node);
                break;

            case "unknown-1":
                this.Unknown1_ = (uint)this.LoadUnsignedIntegerField(Node);
                break;

            case "unknown-2":
                this.Unknown2_ = (ushort)this.LoadUnsignedIntegerField(Node);
                break;

            case "unknown-3":
                this.Unknown3_ = (uint)this.LoadUnsignedIntegerField(Node);
                break;

            case "unknown-4":
                this.Unknown4_ = (uint)this.LoadUnsignedIntegerField(Node);
                break;

            case "use-delay":
                this.UseDelay_ = (ushort)this.LoadUnsignedIntegerField(Node);
                break;

            case "valid-targets":
                this.ValidTargets_ = (ValidTarget)this.LoadHexField(Node);
                break;

            // Sub-Things
            case "icon":
                if (this.Icon_ == null)
                {
                    this.Icon_ = new Graphic();
                }
                this.LoadThingField(Node, this.Icon_);
                break;
            }
        }
Example #19
0
        protected override void LoadField(string Field, System.Xml.XmlElement Node)
        {
            switch (Field)
            {
            // "Simple" Fields
            case "casting-time":
                this.CastingTime_ = (byte)this.LoadUnsignedIntegerField(Node);
                break;

            case "element":
                this.Element_ = (Element)this.LoadHexField(Node);
                break;

            case "english-description":
                this.EnglishDescription_ = this.LoadTextField(Node);
                break;

            case "english-name":
                this.EnglishName_ = this.LoadTextField(Node);
                break;

            case "id":
                this.ID_ = (ushort)this.LoadUnsignedIntegerField(Node);
                break;

            case "index":
                this.Index_ = (ushort)this.LoadUnsignedIntegerField(Node);
                break;

            case "japanese-description":
                this.JapaneseDescription_ = this.LoadTextField(Node);
                break;

            case "japanese-name":
                this.JapaneseName_ = this.LoadTextField(Node);
                break;

            case "level-required":
                this.LevelRequired_ = this.LoadIntegerArray <int>(Node);
                break;

            case "list-icon-id":
                this.ListIconID_ = (byte)this.LoadUnsignedIntegerField(Node);
                break;

            case "magic-type":
                this.MagicType_ = (MagicType)this.LoadHexField(Node);
                break;

            case "mp-cost":
                this.MPCost_ = (ushort)this.LoadUnsignedIntegerField(Node);
                break;

            case "recast-delay":
                this.RecastDelay_ = (ushort)this.LoadUnsignedIntegerField(Node);
                break;

            case "skill":
                this.Skill_ = (Skill)this.LoadHexField(Node);
                break;

            case "valid-targets":
                this.ValidTargets_ = (ValidTarget)this.LoadHexField(Node);
                break;
            }
        }
Example #20
0
 protected override void SetParent(Element?e)
 => throw new InvalidOperationException("RootElement cannot be added as a child");
Example #21
0
 // Block Layout:
 // 000-001 U16 Index
 // 002-003 U16 Magic Type (1/2/3/4/5/6 - White/Black/Summon/Ninja/Bard/Blue)
 // 004-005 U16 Element
 // 006-007 U16 Valid Targets
 // 008-009 U16 Skill
 // 00a-00b U16 MP Cost
 // 00c-00c U8  Cast Time (1/4 second)
 // 00d-00d U8  Recast Delay (1/4 second)
 // 00e-025 U8  Level required (1 byte per job, 0xff if not learnable; first is for the NUL job, so always 0xff; only 24 slots despite 32 possible job flags)
 // 026-027 U16 ID (0 for "unused" spells; starts out equal to the index, but doesn't stay that way)
 // 028-028 U8  List Icon ID (not sure what this is an index of, but it seems to match differences in item icon)
 // 029-03c CHR Japanese Name (20 bytes)
 // 03d-051 CHR English Name (20 bytes)
 // 052-0d1 CHR Japanese Description (128 bytes)
 // 0d2-151 CHR English Description (128 bytes)
 // 152-3fe U8  Padding (NULs)
 // 3ff-3ff U8  End marker (0xff)
 public bool Read(BinaryReader BR)
 {
     this.Clear();
       try {
       byte[] Bytes = BR.ReadBytes(0x400);
     if (Bytes[0x3] != 0x00 || Bytes[0x5] != 0x00 || Bytes[0x7] != 0x00 || Bytes[0x9] != 0x00 || Bytes[0xf] != 0xff || Bytes[0x3ff] != 0xff)
       return false;
     if (!FFXIEncryption.DecodeDataBlock(Bytes))
       return false;
     BR = new BinaryReader(new MemoryStream(Bytes, false));
       } catch { return false; }
       this.Index_         = BR.ReadUInt16();
       this.MagicType_     = (MagicType)   BR.ReadUInt16();
       this.Element_       = (Element)     BR.ReadUInt16();
       this.ValidTargets_  = (ValidTarget) BR.ReadUInt16();
       this.Skill_         = (Skill)       BR.ReadUInt16();
       this.MPCost_        = BR.ReadUInt16();
       this.CastingTime_   = BR.ReadByte();
       this.RecastDelay_   = BR.ReadByte();
       this.LevelRequired_ = BR.ReadBytes(24);
       this.ID_            = BR.ReadUInt16();
       this.ListIconID_    = BR.ReadByte();
       FFXIEncoding E = new FFXIEncoding();
       this.JapaneseName_        = E.GetString(BR.ReadBytes( 20)).TrimEnd('\0');
       this.EnglishName_         = E.GetString(BR.ReadBytes( 20)).TrimEnd('\0');
       this.JapaneseDescription_ = E.GetString(BR.ReadBytes(128)).TrimEnd('\0');
       this.EnglishDescription_  = E.GetString(BR.ReadBytes(128)).TrimEnd('\0');
       // A slightly newer revision of this format no longer has the names, so mark them unset when empty
       if (this.JapaneseName_       .Length == 0) this.JapaneseName_        = null;
       if (this.EnglishName_        .Length == 0) this.EnglishName_         = null;
       if (this.JapaneseDescription_.Length == 0) this.JapaneseDescription_ = null;
       if (this.EnglishDescription_ .Length == 0) this.EnglishDescription_  = null;
     #if DEBUG
       { // Read the next 64 bits, and report if it's not 0 (means there's new data to identify)
       ulong Next64 = BR.ReadUInt64();
     if (Next64 != 0) {
       Console.ForegroundColor = ConsoleColor.Red;
       Console.WriteLine("Nonzero data after entry (Spell #{0}): {1:X16}", this.ID_, Next64);
       Console.ResetColor();
     }
       }
     #endif
       BR.Close();
       return true;
 }
Example #22
0
 protected override void LoadField(string Field, System.Xml.XmlElement Node)
 {
     switch (Field)
     {
         // "Simple" Fields
     case "casting-time":
         this.CastingTime_ = (byte)this.LoadUnsignedIntegerField(Node);
         break;
     case "element":
         this.Element_ = (Element)this.LoadHexField(Node);
         break;
     case "list-icon-id":
         this.ListIconID_ = (byte)this.LoadUnsignedIntegerField(Node);
         break;
     case "id":
         this.ID_ = (ushort)this.LoadUnsignedIntegerField(Node);
         break;
     case "index":
         this.Index_ = (ushort)this.LoadUnsignedIntegerField(Node);
         break;
     case "level-required":
         this.LevelRequired_ = this.LoadIntegerArray<int>(Node);
         break;
     case "magic-type":
         this.MagicType_ = (MagicType)this.LoadHexField(Node);
         break;
     case "mp-cost":
         this.MPCost_ = (ushort)this.LoadUnsignedIntegerField(Node);
         break;
     case "recast-delay":
         this.RecastDelay_ = (ushort)this.LoadUnsignedIntegerField(Node);
         break;
     case "skill":
         this.Skill_ = (Skill)this.LoadHexField(Node);
         break;
     case "unknown-1":
         this.Unknown1_ = (byte)this.LoadUnsignedIntegerField(Node);
         break;
     case "unknown-2":
         this.Unknown2_ = (byte)this.LoadUnsignedIntegerField(Node);
         break;
     case "unknown-3":
         this.Unknown3_ = (byte)this.LoadUnsignedIntegerField(Node);
         break;
     case "unknown-4":
         this.Unknown4_ = (byte)this.LoadUnsignedIntegerField(Node);
         break;
     case "valid-targets":
         this.ValidTargets_ = (ValidTarget)this.LoadHexField(Node);
         break;
     }
 }
Example #23
0
 public CompilerException(Element?origin) : this(origin, null, null)
 {
 }
Example #24
0
 public void TriggerEvent(string eventName, Element?source = null)
 {
     TriggerEvent(eventName, source, Array.Empty <LuaValue>());
 }
Example #25
0
 // Block Layout:
 // 000-001 U16 Index
 // 002-003 U16 Magic Type (1/2/3/4/5/6 - White/Black/Summon/Ninja/Bard/Blue)
 // 004-005 U16 Element
 // 006-007 U16 Valid Targets
 // 008-009 U16 Skill
 // 00a-00b U16 MP Cost
 // 00c-00c U8  Cast Time (1/4 second)
 // 00d-00d U8  Recast Delay (1/4 second)
 // 00e-025 U8  Level required (1 byte per job, 0xff if not learnable; first is for the NUL job, so always 0xff; only 24 slots despite 32 possible job flags)
 // 026-027 U16 ID (0 for "unused" spells; starts out equal to the index, but doesn't stay that way)
 // 028-028 U8  List Icon ID (not sure what this is an index of, but it seems to match differences in item icon)
 // 029-029 U8  Unknown #1
 // 02a-02b U8  Unknown #2
 // 02c-02d U8  Unknown #3
 // 02e-02f U8  Unknown #4
 // 030-03e U8  Padding (NULs)
 // 03f-03f U8  End marker (0xff)
 public bool Read(BinaryReader BR)
 {
     this.Clear();
     try
     {
         byte[] Bytes = BR.ReadBytes(0x58);
         //if (Bytes[0x3] != 0x00 || Bytes[0x5] != 0x00 || Bytes[0x7] != 0x00 || Bytes[0x9] != 0x00 || Bytes[0xf] != 0xff || Bytes[0x3f] != 0xff)
         //return false;
         if (!FFXIEncryption.DecodeDataBlockMask(Bytes))
         {
             return false;
         }
         BR = new BinaryReader(new MemoryStream(Bytes, false));
     }
     catch
     {
         return false;
     }
     this.Index_ = BR.ReadUInt16();
     this.MagicType_ = (MagicType)BR.ReadUInt16();
     this.Element_ = (Element)BR.ReadUInt16();
     this.ValidTargets_ = (ValidTarget)BR.ReadUInt16();
     this.Skill_ = (Skill)BR.ReadUInt16();
     this.MPCost_ = BR.ReadUInt16();
     this.CastingTime_ = BR.ReadByte();
     this.RecastDelay_ = BR.ReadByte();
     this.LevelRequired_ = new int[0x18];
     for (var i = 0; i < 0x18; ++i)
     {
         this.LevelRequired_[i] = BR.ReadInt16();
     }
     this.ID_ = BR.ReadUInt16();
     this.ListIconID_ = BR.ReadByte();
     this.Unknown1_ = BR.ReadByte();
     this.Unknown2_ = BR.ReadByte();
     this.Unknown3_ = BR.ReadByte();
     this.Unknown4_ = BR.ReadByte();
     this.Unknown5_ = BR.ReadUInt32();
     #if DEBUG // Check the padding bytes for unexpected data
     for (byte i = 0; i < 14; ++i)
     {
         byte PaddingByte = BR.ReadByte();
         if (PaddingByte != 0)
         {
             Console.WriteLine("MonsterSpellInfo2: Entry #{0}: Padding Byte #{1} is non-zero: {2:X2} ({2})", this.Index_,
                 i + 1, PaddingByte);
         }
     }
     #endif
     BR.Close();
     return true;
 }
Example #26
0
 public CompilerException(Element?origin, string?message) : this(origin, message, null)
 {
 }
Example #27
0
        protected override Node View(SearchViewModel currentViewModel)
        {
            _searchInput =
                input
                (
                    @class("form-control"),
                    placeholder("Search for products"),
                    autocomplete("off"),
                    autocapitalize("off"),
                    attribute("aria-labelledby", "search-label"),
                    type("text"),
                    spellcheck("false"),
                    attribute("role", "textbox"),

                    bind.input(currentViewModel.SearchTerm, searchTerm => currentViewModel.SearchTerm = searchTerm),
                    on.keydown(async args =>
            {
                if (args.Key == "Enter")
                {
                    await currentViewModel.ExecuteSearch();
                    StateHasChanged();
                }
            })
                );


            return(concat
                   (
                       header
                       (
                           @class("bg-light shadow-sm fixed-top data-fixed-element"),
                           div
                           (
                               @class("navbar navbar-expand-lg navbar-light shadow"),
                               div
                               (
                                   @class("container-fluid"),
                                   a
                                   (
                                       new[]
            {
                @class("navbar-brand"),
                href("/")
            },
                                       img
                                       (
                                           src("https://via.placeholder.com/142x34/")
                                       )
                                   ),

                                   div
                                   (
                                       @class("input-group"),
                                       _searchInput,
                                       button
                                       (
                                           new[]
            {
                @class("btn btn-large btn-primary"),
                type("button"),
                on.click(async _ =>
                {
                    await currentViewModel.ExecuteSearch();
                    StateHasChanged();
                })
            },
                                           i
                                           (
                                               @class("bi bi-search")
                                           )
                                       )
                                   )
                               )
                           )
                       ),
                       main
                       (

                           new[]
            {
                @class("pt-5")
            },
                           component <List>(Array.Empty <Radix.Components.Attribute>()),
                           section
                           (
                               @class("ps-lg-4 pe-lg-3 pt-5"),
                               div
                               (
                                   @class("row row-cols-2 row-cols-md-4 row-cols-lg-6 g-0 mx-n2"),
                                   currentViewModel.Products.Select
                                   (
                                       product =>
            {
                return
                div
                (
                    @class("col g-4"),
                    div
                    (
                        new[]
                {
                    @class("card shadow-sm"),
                    id("product-card"),
                    attribute("style", "border:0; transition: all .15s ease-in-out"),
                },
                        style
                        (
                            text
                            (
                                "#product-card:hover #product-title { text-overflow: initial; overflow: initial; white-space: initial;}" +
                                "#product-card:hover { transform: scale(1.05); box-shadow: 0 .5rem 1rem rgba(0,0,0,.15)!important;"
                            )
                        ),
                        img
                        (
                            new[]
                {
                    @class("card-img-top d-block overflow-hidden p-3"),
                    src(product.ImageSource)
                }

                        ),
                        div
                        (
                            @class("card-body py-2"),
                            div
                            (
                                @class("d-flex align-items-center justify-content-between"),
                                div
                                (
                                    p
                                    (
                                        @class("text-accent mb-0"),
                                        text
                                        (
                                            product.PriceUnits + NumberFormatInfo.CurrentInfo.NumberDecimalSeparator
                                        ),
                                        sup
                                        (
                                            text
                                            (
                                                product.PriceFraction
                                            )
                                        )
                                    ),
                                    p
                                    (
                                        attribute("style", "font-size: .6em"),
                                        text
                                        (
                                            $"{product.UnitSize} {product.UnitOfMeasure}"
                                        )
                                    )
                                ),

                                currentViewModel.GetMerchentLogo(product.MerchantName)
                                ,
                                div
                                (
                                    p
                                    (
                                        @class("text-accent mb-0"),
                                        text
                                        (
                                            product.PricePerUnitPriceUnits + NumberFormatInfo.CurrentInfo.NumberDecimalSeparator
                                        ),
                                        sup
                                        (
                                            text
                                            (
                                                product.PricePerUnitPriceFraction
                                            )
                                        )
                                    ),
                                    p
                                    (
                                        attribute("style", "font-size: .6em"),
                                        text
                                        (
                                            $"/ {product.UnitOfMeasure}"
                                        )
                                    )
                                )
                            ),
                            h6
                            (
                                new[]
                {
                    @class("text-truncate card-title"),
                    id("product-title")
                },
                                text
                                (
                                    product.Title
                                )
                            )
                        )
                    )
                );
            }
                                   ).ToArray()
                               )
                           )
                       )
                   ));
        }
Example #28
0
 public CompilerException(Element?origin, string?message, Exception?innerException) : this(message, innerException)
 {
     Origin = origin;
 }
Example #29
0
 public void TriggerLatentEvent(string eventName, Resource sourceResource, Element?source = null, int rate = 50000, params LuaValue[] parameters)
 {
     TriggerLatentEvent(this.elementRepository.GetByType <Player>(ElementType.Player), eventName, sourceResource, source, rate, parameters);
 }
Example #30
0
 protected static void SetParent(Element target, Element?e) => target.SetParent(e);
Example #31
0
 public void TriggerEvent(Player[] players, string eventName, Element?source = null, params LuaValue[] parameters)
 {
     new LuaEventPacket(eventName, (source ?? this.root).Id, parameters).SendTo(players);
 }
Example #32
0
 protected virtual void SetParent(Element?e) => Parent = e;
Example #33
0
        public bool Read(BinaryReader BR, Type T)
        {
            this.Clear();
            try
            {
                byte[] ItemBytes = BR.ReadBytes(0xC00);
                FFXIEncryption.Rotate(ItemBytes, 5);
                BR = new BinaryReader(new MemoryStream(ItemBytes, false));
                BR.BaseStream.Seek(0x280, SeekOrigin.Begin);
                Graphic G = new Graphic();
                int GraphicSize = BR.ReadInt32();
                if (GraphicSize < 0 || !G.Read(BR) || BR.BaseStream.Position != 0x280 + 4 + GraphicSize)
                {
                    BR.Close();
                    return false;
                }
                this.Icon_ = G;
                BR.BaseStream.Seek(0, SeekOrigin.Begin);
            }
            catch
            {
                return false;
            }
            // Common Fields (14 bytes)
            this.ID_ = BR.ReadUInt32();
            this.Flags_ = (ItemFlags)BR.ReadUInt16();
            this.StackSize_ = BR.ReadUInt16(); // 0xe0ff for Currency, which kinda suggests this is really 2 separate bytes
            this.Type_ = (ItemType)BR.ReadUInt16();
            this.ResourceID_ = BR.ReadUInt16();
            this.ValidTargets_ = (ValidTarget)BR.ReadUInt16();
            // Extra Fields (22/30/10/6/2 bytes for Armor/Weapon/Puppet/Item/UsableItem)

            if (T == Type.Armor || T == Type.Weapon)
            {
                this.Level_ = BR.ReadUInt16();
                this.Slots_ = (EquipmentSlot)BR.ReadUInt16();
                this.Races_ = (Race)BR.ReadUInt16();
                this.Jobs_ = (Job)BR.ReadUInt32();
                this.SuperiorLevel_ = BR.ReadUInt16();
                if (T == Type.Armor)
                {
                    this.ShieldSize_ = BR.ReadUInt16();
                }
                else
                {
                    // Weapon
                    this.Unknown4_ = BR.ReadUInt16();
                    this.Damage_ = BR.ReadUInt16();
                    this.Delay_ = BR.ReadInt16();
                    this.DPS_ = BR.ReadUInt16();
                    this.Skill_ = (Skill)BR.ReadByte();
                    this.JugSize_ = BR.ReadByte();
                    this.Unknown1_ = BR.ReadUInt32();
                }
                this.MaxCharges_ = BR.ReadByte();
                this.CastingTime_ = BR.ReadByte();
                this.UseDelay_ = BR.ReadUInt16();
                this.ReuseDelay_ = BR.ReadUInt32();
                this.Unknown2_ = BR.ReadUInt16();
                this.iLevel_ = BR.ReadUInt16();
                this.Unknown3_ = BR.ReadUInt32();
            }
            else if (T == Type.PuppetItem)
            {
                this.PuppetSlot_ = (PuppetSlot)BR.ReadUInt16();
                this.ElementCharge_ = BR.ReadUInt32();
                this.Unknown3_ = BR.ReadUInt32();
            }
            else if (T == Type.Instinct)
            {
                BR.ReadUInt32();
                BR.ReadUInt32();
                BR.ReadUInt16();
                this.InstinctCost_ = BR.ReadUInt16();
                BR.ReadUInt16();
                BR.ReadUInt32();
                BR.ReadUInt32();
                BR.ReadUInt32();
            }
            else if (T == Type.Item)
            {
                switch (this.Type_.Value)
                {
                    case ItemType.Flowerpot:
                    case ItemType.Furnishing:
                    case ItemType.Mannequin:
                        this.Element_ = (Element)BR.ReadUInt16();
                        this.StorageSlots_ = BR.ReadInt32();
                        this.Unknown3_ = BR.ReadUInt32();
                        break;
                    default:
                        this.Unknown2_ = BR.ReadUInt16();
                        this.Unknown3_ = BR.ReadUInt32();
                        this.Unknown3_ = BR.ReadUInt32();
                        break;
                }
            }
            else if (T == Type.UsableItem)
            {
                this.ActivationTime_ = BR.ReadUInt16();
                this.Unknown1_ = BR.ReadUInt32();
                this.Unknown3_ = BR.ReadUInt32();
                this.Unknown4_ = BR.ReadUInt32();
            }
            else if (T == Type.Currency)
            {
                this.Unknown2_ = BR.ReadUInt16();
            }
            else if (T == Type.Slip)
            {
                this.Unknown1_ = BR.ReadUInt16();
                for (int counter = 0; counter < 17; counter++)
                {
                    BR.ReadUInt32();
                }
            }
            else if (T == Type.Monipulator)
            {
                this.Unknown1_ = BR.ReadUInt16();
                for (int counter = 0; counter < 24; counter++)
                {
                    BR.ReadInt32();
                }
            }
            // Next Up: Strings (variable size)
            long StringBase = BR.BaseStream.Position;
            uint StringCount = BR.ReadUInt32();
            if (StringCount > 9)
            {
                // Sanity check, for safety - 0 strings is fine for now
                this.Clear();
                return false;
            }
            FFXIEncoding E = new FFXIEncoding();
            string[] Strings = new string[StringCount];
            for (byte i = 0; i < StringCount; ++i)
            {
                long Offset = StringBase + BR.ReadUInt32();
                uint Flag = BR.ReadUInt32();
                if (Offset < 0 || Offset + 0x20 > 0x280 || (Flag != 0 && Flag != 1))
                {
                    this.Clear();
                    return false;
                }
                // Flag seems to be 1 if the offset is not actually an offset. Could just be padding to make StringCount unique per language, or it could be an indication
                // of the pronoun to use (a/an/the/...). The latter makes sense because of the increased number of such flags for french and german.
                if (Flag == 0)
                {
                    BR.BaseStream.Position = Offset;
                    Strings[i] = this.ReadString(BR, E);
                    if (Strings[i] == null)
                    {
                        this.Clear();
                        return false;
                    }
                    BR.BaseStream.Position = StringBase + 4 + 8 * (i + 1);
                }
            }
            // Assign the strings to the proper fields
            switch (StringCount)
            {
                case 1:
                    this.Name_ = Strings[0];
                    break;
                case 2: // Japanese
                    this.Name_ = Strings[0];
                    this.Description_ = Strings[1];
                    break;
                case 5: // English
                    this.Name_ = Strings[0];
                    // unused:              Strings[1]
                    this.LogNameSingular_ = Strings[2];
                    this.LogNamePlural_ = Strings[3];
                    this.Description_ = Strings[4];
                    break;
                case 6: // French
                    this.Name_ = Strings[0];
                    // unused:              Strings[1]
                    // unused:              Strings[2]
                    this.LogNameSingular_ = Strings[3];
                    this.LogNamePlural_ = Strings[4];
                    this.Description_ = Strings[5];
                    break;
                case 9: // German
                    this.Name_ = Strings[0];
                    // unused:              Strings[1]
                    // unused:              Strings[2]
                    // unused:              Strings[3]
                    this.LogNameSingular_ = Strings[4];
                    // unused:              Strings[5]
                    // unused:              Strings[6]
                    this.LogNamePlural_ = Strings[7];
                    this.Description_ = Strings[8];
                    break;
            }
            BR.Close();
            return true;
        }
Example #34
0
 public void Output(string message, Color?color = null, bool isColorCoded = false, ChatEchoType type = ChatEchoType.Player, Element?source = null)
 {
     this.server.BroadcastPacket(new ChatEchoPacket(source?.Id ?? this.root.Id, message, color ?? Color.White, type, isColorCoded));
 }
Example #35
0
 public TileCard(bool isHost, int modifier, string name, int level, Rank rank, Element?element = null)
     : this(new Card(name, level, rank, element), isHost, modifier)
 {
 }
Example #36
0
 public void OutputTo(Player player, string message, Color?color = null, bool isColorCoded = false, ChatEchoType type = ChatEchoType.Player, Element?source = null)
 {
     player.Client.SendPacket(new ChatEchoPacket(source?.Id ?? this.root.Id, message, color ?? Color.White, type, isColorCoded));
 }
Example #37
0
        public bool Read(BinaryReader BR, Type T)
        {
            this.Clear();
            try
            {
                byte[] ItemBytes = BR.ReadBytes(0xC00);
                FFXIEncryption.Rotate(ItemBytes, 5);
                BR = new BinaryReader(new MemoryStream(ItemBytes, false));
                BR.BaseStream.Seek(0x280, SeekOrigin.Begin);
                Graphic G           = new Graphic();
                int     GraphicSize = BR.ReadInt32();
                if (GraphicSize < 0 || !G.Read(BR) || BR.BaseStream.Position != 0x280 + 4 + GraphicSize)
                {
                    BR.Close();
                    return(false);
                }
                this.Icon_ = G;
                BR.BaseStream.Seek(0, SeekOrigin.Begin);
            }
            catch
            {
                return(false);
            }
            // Common Fields (14 bytes)
            this.ID_           = BR.ReadUInt32();
            this.Flags_        = (ItemFlags)BR.ReadUInt16();
            this.StackSize_    = BR.ReadUInt16(); // 0xe0ff for Currency, which kinda suggests this is really 2 separate bytes
            this.Type_         = (ItemType)BR.ReadUInt16();
            this.ResourceID_   = BR.ReadUInt16();
            this.ValidTargets_ = (ValidTarget)BR.ReadUInt16();
            // Extra Fields (22/30/10/6/2 bytes for Armor/Weapon/Puppet/Item/UsableItem)

            if (T == Type.Armor || T == Type.Weapon)
            {
                this.Level_         = BR.ReadUInt16();
                this.Slots_         = (EquipmentSlot)BR.ReadUInt16();
                this.Races_         = (Race)BR.ReadUInt16();
                this.Jobs_          = (Job)BR.ReadUInt32();
                this.SuperiorLevel_ = BR.ReadUInt16();
                if (T == Type.Armor)
                {
                    this.ShieldSize_ = BR.ReadUInt16();
                }
                else
                {
                    // Weapon
                    this.Unknown4_ = BR.ReadUInt16();
                    this.Damage_   = BR.ReadUInt16();
                    this.Delay_    = BR.ReadInt16();
                    this.DPS_      = BR.ReadUInt16();
                    this.Skill_    = (Skill)BR.ReadByte();
                    this.JugSize_  = BR.ReadByte();
                    this.Unknown1_ = BR.ReadUInt32();
                }
                this.MaxCharges_  = BR.ReadByte();
                this.CastingTime_ = BR.ReadByte();
                this.UseDelay_    = BR.ReadUInt16();
                this.ReuseDelay_  = BR.ReadUInt32();
                this.Unknown2_    = BR.ReadUInt16();
                this.iLevel_      = BR.ReadUInt16();
                this.Unknown3_    = BR.ReadUInt32();
            }
            else if (T == Type.PuppetItem)
            {
                this.PuppetSlot_    = (PuppetSlot)BR.ReadUInt16();
                this.ElementCharge_ = BR.ReadUInt32();
                this.Unknown3_      = BR.ReadUInt32();
            }
            else if (T == Type.Instinct)
            {
                BR.ReadUInt32();
                BR.ReadUInt32();
                BR.ReadUInt16();
                this.InstinctCost_ = BR.ReadUInt16();
                BR.ReadUInt16();
                BR.ReadUInt32();
                BR.ReadUInt32();
                BR.ReadUInt32();
            }
            else if (T == Type.Item)
            {
                switch (this.Type_.Value)
                {
                case ItemType.Flowerpot:
                case ItemType.Furnishing:
                case ItemType.Mannequin:
                    this.Element_      = (Element)BR.ReadUInt16();
                    this.StorageSlots_ = BR.ReadInt32();
                    this.Unknown3_     = BR.ReadUInt32();
                    break;

                default:
                    this.Unknown2_ = BR.ReadUInt16();
                    this.Unknown3_ = BR.ReadUInt32();
                    this.Unknown3_ = BR.ReadUInt32();
                    break;
                }
            }
            else if (T == Type.UsableItem)
            {
                this.ActivationTime_ = BR.ReadUInt16();
                this.Unknown1_       = BR.ReadUInt32();
                this.Unknown3_       = BR.ReadUInt32();
                this.Unknown4_       = BR.ReadUInt32();
            }
            else if (T == Type.Currency)
            {
                this.Unknown2_ = BR.ReadUInt16();
            }
            else if (T == Type.Slip)
            {
                this.Unknown1_ = BR.ReadUInt16();
                for (int counter = 0; counter < 17; counter++)
                {
                    BR.ReadUInt32();
                }
            }
            else if (T == Type.Monipulator)
            {
                this.Unknown1_ = BR.ReadUInt16();
                for (int counter = 0; counter < 24; counter++)
                {
                    BR.ReadInt32();
                }
            }
            // Next Up: Strings (variable size)
            long StringBase  = BR.BaseStream.Position;
            uint StringCount = BR.ReadUInt32();

            if (StringCount > 9)
            {
                // Sanity check, for safety - 0 strings is fine for now
                this.Clear();
                return(false);
            }
            FFXIEncoding E = new FFXIEncoding();

            string[] Strings = new string[StringCount];
            for (byte i = 0; i < StringCount; ++i)
            {
                long Offset = StringBase + BR.ReadUInt32();
                uint Flag   = BR.ReadUInt32();
                if (Offset < 0 || Offset + 0x20 > 0x280 || (Flag != 0 && Flag != 1))
                {
                    this.Clear();
                    return(false);
                }
                // Flag seems to be 1 if the offset is not actually an offset. Could just be padding to make StringCount unique per language, or it could be an indication
                // of the pronoun to use (a/an/the/...). The latter makes sense because of the increased number of such flags for french and german.
                if (Flag == 0)
                {
                    BR.BaseStream.Position = Offset;
                    Strings[i]             = this.ReadString(BR, E);
                    if (Strings[i] == null)
                    {
                        this.Clear();
                        return(false);
                    }
                    BR.BaseStream.Position = StringBase + 4 + 8 * (i + 1);
                }
            }
            // Assign the strings to the proper fields
            switch (StringCount)
            {
            case 1:
                this.Name_ = Strings[0];
                break;

            case 2:     // Japanese
                this.Name_        = Strings[0];
                this.Description_ = Strings[1];
                break;

            case 5:     // English
                this.Name_ = Strings[0];
                // unused:              Strings[1]
                this.LogNameSingular_ = Strings[2];
                this.LogNamePlural_   = Strings[3];
                this.Description_     = Strings[4];
                break;

            case 6:     // French
                this.Name_ = Strings[0];
                // unused:              Strings[1]
                // unused:              Strings[2]
                this.LogNameSingular_ = Strings[3];
                this.LogNamePlural_   = Strings[4];
                this.Description_     = Strings[5];
                break;

            case 9:     // German
                this.Name_ = Strings[0];
                // unused:              Strings[1]
                // unused:              Strings[2]
                // unused:              Strings[3]
                this.LogNameSingular_ = Strings[4];
                // unused:              Strings[5]
                // unused:              Strings[6]
                this.LogNamePlural_ = Strings[7];
                this.Description_   = Strings[8];
                break;
            }
            BR.Close();
            return(true);
        }
Example #38
0
 public static Card Build(Guid id, string name, int level, Element?element = null)
 {
     return(new Card(id, name, level, element));
 }
Example #39
0
        // Block Layout:
        // 000-001 U16 Index
        // 002-003 U16 Magic Type (1/2/3/4/5/6 - White/Black/Summon/Ninja/Bard/Blue)
        // 004-005 U16 Element
        // 006-007 U16 Valid Targets
        // 008-009 U16 Skill
        // 00a-00b U16 MP Cost
        // 00c-00c U8  Cast Time (1/4 second)
        // 00d-00d U8  Recast Delay (1/4 second)
        // 00e-025 U8  Level required (1 byte per job, 0xff if not learnable; first is for the NUL job, so always 0xff; only 24 slots despite 32 possible job flags)
        // 026-027 U16 ID (0 for "unused" spells; starts out equal to the index, but doesn't stay that way)
        // 028-028 U8  List Icon ID (not sure what this is an index of, but it seems to match differences in item icon)
        // 029-03c CHR Japanese Name (20 bytes)
        // 03d-051 CHR English Name (20 bytes)
        // 052-0d1 CHR Japanese Description (128 bytes)
        // 0d2-151 CHR English Description (128 bytes)
        // 152-3fe U8  Padding (NULs)
        // 3ff-3ff U8  End marker (0xff)
        public bool Read(BinaryReader BR)
        {
            this.Clear();
            try
            {
                byte[] Bytes = BR.ReadBytes(0x400);
                if (Bytes[0x3] != 0x00 || Bytes[0x5] != 0x00 || Bytes[0x7] != 0x00 || Bytes[0x9] != 0x00 || Bytes[0xf] != 0xff ||
                    Bytes[0x3ff] != 0xff)
                {
                    return(false);
                }
                if (!FFXIEncryption.DecodeDataBlock(Bytes))
                {
                    return(false);
                }
                BR = new BinaryReader(new MemoryStream(Bytes, false));
            }
            catch
            {
                return(false);
            }
            this.Index_         = BR.ReadUInt16();
            this.MagicType_     = (MagicType)BR.ReadUInt16();
            this.Element_       = (Element)BR.ReadUInt16();
            this.ValidTargets_  = (ValidTarget)BR.ReadUInt16();
            this.Skill_         = (Skill)BR.ReadUInt16();
            this.MPCost_        = BR.ReadUInt16();
            this.CastingTime_   = BR.ReadByte();
            this.RecastDelay_   = BR.ReadByte();
            this.LevelRequired_ = new int[0x18];
            for (var i = 0; i < 0x18; ++i)
            {
                this.LevelRequired_[i] = BR.ReadInt16();
            }
            this.ID_         = BR.ReadUInt16();
            this.ListIconID_ = BR.ReadByte();
            BR.ReadBytes(0x04);
            FFXIEncoding E = new FFXIEncoding();

            this.JapaneseName_        = E.GetString(BR.ReadBytes(20)).TrimEnd('\0');
            this.EnglishName_         = E.GetString(BR.ReadBytes(20)).TrimEnd('\0');
            this.JapaneseDescription_ = E.GetString(BR.ReadBytes(128)).TrimEnd('\0');
            this.EnglishDescription_  = E.GetString(BR.ReadBytes(128)).TrimEnd('\0');
            // A slightly newer revision of this format no longer has the names, so mark them unset when empty
            if (this.JapaneseName_.Length == 0)
            {
                this.JapaneseName_ = null;
            }
            if (this.EnglishName_.Length == 0)
            {
                this.EnglishName_ = null;
            }
            if (this.JapaneseDescription_.Length == 0)
            {
                this.JapaneseDescription_ = null;
            }
            if (this.EnglishDescription_.Length == 0)
            {
                this.EnglishDescription_ = null;
            }
#if DEBUG
            {
                // Read the next 64 bits, and report if it's not 0 (means there's new data to identify)
                ulong Next64 = BR.ReadUInt64();
                if (Next64 != 0)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Nonzero data after entry (Spell #{0}): {1:X16}", this.ID_, Next64);
                    Console.ResetColor();
                }
            }
#endif
            BR.Close();
            return(true);
        }
Example #40
0
    public void TriggerLatentEventForMany(IEnumerable <Player> players, string eventName, Resource sourceResource, Element?source = null, int rate = 50000, params LuaValue[] parameters)
    {
        var packet = new LuaEventPacket(eventName, (source ?? this.root).Id, parameters);

        this.latentPacketService.EnqueueLatentPacket(players, packet, sourceResource.NetId, rate);
    }