예제 #1
0
 public static JsonItem FromItem(Item i)
 {
     if (i == null)
     {
         return(null);
     }
     else
     {
         JsonItem res = new JsonItem(i.Id, i.Name, SlotUtil.ToString(i.Slot), Attributes.ToStringDic(i.Attributes), ClassicCraft.Enchantment.FromEnchantment(i.Enchantment));
         if (res.Stats != null)
         {
             if (res.Stats.ContainsKey("Crit"))
             {
                 res.Stats["Crit"] *= 100;
             }
             if (res.Stats.ContainsKey("Hit"))
             {
                 res.Stats["Hit"] *= 100;
             }
             if (res.Stats.ContainsKey("AS"))
             {
                 res.Stats["AS"] *= 100;
             }
             if (res.Stats.ContainsKey("SpellHit"))
             {
                 res.Stats["SpellHit"] *= 100;
             }
             if (res.Stats.ContainsKey("SpellCrit"))
             {
                 res.Stats["SpellCrit"] *= 100;
             }
         }
         if (res.Enchantment != null)
         {
             if (res.Enchantment.Stats.ContainsKey("Crit"))
             {
                 res.Enchantment.Stats["Crit"] *= 100;
             }
             if (res.Enchantment.Stats.ContainsKey("Hit"))
             {
                 res.Enchantment.Stats["Hit"] *= 100;
             }
             if (res.Enchantment.Stats.ContainsKey("AS"))
             {
                 res.Enchantment.Stats["AS"] *= 100;
             }
             if (res.Enchantment.Stats.ContainsKey("SpellHit"))
             {
                 res.Enchantment.Stats["SpellHit"] *= 100;
             }
             if (res.Enchantment.Stats.ContainsKey("SpellCrit"))
             {
                 res.Enchantment.Stats["SpellCrit"] *= 100;
             }
         }
         return(res);
     }
 }
예제 #2
0
 public static JsonWeapon FromWeapon(Weapon w)
 {
     if (w == null)
     {
         return(null);
     }
     else
     {
         JsonWeapon res = new JsonWeapon(w.DamageMin, w.DamageMax, w.Speed, w.TwoHanded, Weapon.TypeToString(w.Type), w.Id, w.Name, Attributes.ToStringDic(w.Attributes), ClassicCraft.Enchantment.FromEnchantment(w.Enchantment), ClassicCraft.Enchantment.FromEnchantment(w.Buff), SchoolToString(w.School));
         if (res.Stats != null)
         {
             if (res.Stats.ContainsKey("Crit"))
             {
                 res.Stats["Crit"] *= 100;
             }
             if (res.Stats.ContainsKey("Hit"))
             {
                 res.Stats["Hit"] *= 100;
             }
             if (res.Stats.ContainsKey("AS"))
             {
                 res.Stats["AS"] *= 100;
             }
             if (res.Stats.ContainsKey("SpellHit"))
             {
                 res.Stats["SpellHit"] *= 100;
             }
             if (res.Stats.ContainsKey("SpellCrit"))
             {
                 res.Stats["SpellCrit"] *= 100;
             }
         }
         if (res.Enchantment != null)
         {
             if (res.Enchantment.Stats.ContainsKey("Crit"))
             {
                 res.Enchantment.Stats["Crit"] *= 100;
             }
             if (res.Enchantment.Stats.ContainsKey("Hit"))
             {
                 res.Enchantment.Stats["Hit"] *= 100;
             }
             if (res.Enchantment.Stats.ContainsKey("AS"))
             {
                 res.Enchantment.Stats["AS"] *= 100;
             }
             if (res.Enchantment.Stats.ContainsKey("SpellHit"))
             {
                 res.Enchantment.Stats["SpellHit"] *= 100;
             }
             if (res.Enchantment.Stats.ContainsKey("SpellCrit"))
             {
                 res.Enchantment.Stats["SpellCrit"] *= 100;
             }
         }
         if (res.Buff != null)
         {
             if (res.Buff.Stats.ContainsKey("Crit"))
             {
                 res.Buff.Stats["Crit"] *= 100;
             }
             if (res.Buff.Stats.ContainsKey("Hit"))
             {
                 res.Buff.Stats["Hit"] *= 100;
             }
             if (res.Buff.Stats.ContainsKey("AS"))
             {
                 res.Buff.Stats["AS"] *= 100;
             }
             if (res.Buff.Stats.ContainsKey("SpellHit"))
             {
                 res.Buff.Stats["SpellHit"] *= 100;
             }
             if (res.Buff.Stats.ContainsKey("SpellCrit"))
             {
                 res.Buff.Stats["SpellCrit"] *= 100;
             }
         }
         return(res);
     }
 }