/* Projectile * Sign * Wall * ConnectedWall * MoneyChanger * CharacterChanger * Stalagmite * NameChanger * GuildRegister * GuildChronicle * GuildBoard * CaveWall * Player * Dye * ClosedVaultChest * Merchant * GuildHallPortal * SpiderWeb * GuildMerchant * Portal * Equipment * Container * GameObject * Character */ public static Entity Resolve(short id) { var node = XmlDatas.TypeToElement[id]; string type = node.Element("Class").Value; switch (type) { case "Projectile": throw new Exception("Projectile should not instantiated using Entity.Resolve"); case "Sign": return(new Sign(id)); case "Wall": return(new Wall(id, node)); case "ConnectedWall": case "CaveWall": return(new ConnectedObject(id)); case "GameObject": case "CharacterChanger": case "MoneyChanger": case "NameChanger": return(new StaticObject(id, StaticObject.GetHP(node), true, false, true)); case "Container": return(new Container(node)); case "Player": throw new Exception("Player should not instantiated using Entity.Resolve"); case "Character": //Other characters means enemy return(new Enemy(id)); case "Portal": return(new Portal(id, null)); case "ClosedVaultChest": case "VaultChest": case "GuildMerchant": return(new SellableObject(id)); //case "Merchant": // return new StaticObject(id, null, false, false, false); case "GuildRegister": return(new StaticObject(id, null, false, false, false)); case "GuildHallPortal": return(new StaticObject(id, null, false, false, false)); default: Console.WriteLine("Not supported type: " + type); return(new Entity(id)); } }
public static Entity Resolve(RealmManager manager, ushort id) { var node = manager.GameData.ObjectTypeToElement[id]; string type = node.Element("Class").Value; switch (type) { case "Projectile": throw new Exception("Projectile should not instantiated using Entity.Resolve"); case "Sign": return(new Sign(manager, id)); case "Wall": return(new Wall(manager, id, node)); case "ConnectedWall": case "CaveWall": return(new ConnectedObject(manager, id)); case "GameObject": case "CharacterChanger": case "MoneyChanger": case "NameChanger": case "Workbench": return(new StaticObject(manager, id, StaticObject.GetHP(node), true, false, true)); case "Container": return(new Container(manager, id)); case "Player": throw new Exception("Player should not instantiated using Entity.Resolve"); case "Character": //Other characters means enemy return(new Enemy(manager, id)); case "Portal": return(new Portal(manager, id, null)); case "ClosedVaultChest": case "GuildMerchant": return(new SellableObject(manager, id)); case "GuildHallPortal": return(new StaticObject(manager, id, null, false, false, false)); case "Merchant": return(new Merchant(manager, id)); default: log.Warn($"Not supported type: {type}"); return(new Entity(manager, id)); } }
public static Entity Resolve(RealmManager manager, ushort id) { var node = manager.GameData.ObjectTypeToElement[id]; var cls = node.Element("Class"); if (cls == null) { throw new ArgumentException("Invalid XML Element, field class is missing"); } var type = cls.Value; switch (type) { case "Projectile": throw new Exception("Projectile should not instantiated using Entity.Resolve"); case "Sign": return(new Sign(manager, id)); case "Wall": case "DoubleWall": return(new Wall(manager, id, node)); case "ConnectedWall": case "CaveWall": return(new ConnectedObject(manager, id)); case "GameObject": case "CharacterChanger": case "MoneyChanger": case "NameChanger": return(new StaticObject(manager, id, StaticObject.GetHP(node), StaticObject.GetStatic(node), false, true)); case "GuildRegister": case "GuildChronicle": case "GuildBoard": return(new StaticObject(manager, id, null, false, false, false)); case "Container": return(new Container(manager, node)); case "Player": throw new Exception("Player should not instantiated using Entity.Resolve"); case "Character": //Other characters means enemy return(new Enemy(manager, id)); case "Portal": case "GuildHallPortal": return(new Portal(manager, id, null)); case "ClosedVaultChest": case "ClosedVaultChestGold": case "ClosedGiftChest": case "VaultChest": case "Merchant": return(new Merchants(manager, id)); case "GuildMerchant": return(new GuildMerchant(manager, id)); case "ArenaGuard": case "ArenaPortal": case "MysteryBoxGround": case "ReskinVendor": case "PetUpgrader": case "FortuneTeller": case "YardUpgrader": case "FortuneGround": case "QuestRewards": return(new StaticObject(manager, id, null, true, false, false)); case "Pet": throw new Exception("Pets should not instantiated using Entity.Resolve"); default: Log.Warn("Not supported type: " + type); return(new Entity(manager, id)); } }
public static Entity Resolve(RealmManager manager, ushort id) { XElement node = manager.GameData.ObjectTypeToElement[id]; string type = node.Element("Class").Value; switch (type) { case "Projectile": throw new Exception("Projectile should not instantiated using Entity.Resolve"); case "Sign": return(new Sign(manager, id)); case "Wall": case "DoubleWall": return(new Wall(manager, id, node)); case "ConnectedWall": case "CaveWall": return(new ConnectedObject(manager, id)); case "GameObject": case "CharacterChanger": case "MoneyChanger": case "NameChanger": case "Stalagmite": return(new StaticObject(manager, id, StaticObject.GetHP(node), true, false, true)); case "MarketplaceGround": case "GuildRegister": case "GuildChronicle": case "GuildBoard": case "SpiderWeb": case "InteractNPC": return(new StaticObject(manager, id, null, false, false, false)); case "Container": return(new Container(manager, id)); case "Reforge": case "Forge": return(new Container(manager, id, true)); case "Player": throw new Exception("Player should not instantiated using Entity.Resolve"); case "Character": //Other characters means enemy return(new Enemy(manager, id)); case "Portal": return(new Portal(manager, id, null)); case "ClosedVaultChest": case "Merchant": return(new Merchants(manager, id)); case "GuildHallPortal": return(new StaticObject(manager, id, null, false, false, false)); case "GuildMerchant": return(new GuildMerchant(manager, id)); //case "InteractNPC": //return new InteractNPC(manager, id); default: log.WarnFormat("Not supported type: {0}", type); return(new Entity(manager, id)); } }
public static Entity Resolve(RealmManager manager, ushort id) { var node = manager.Resources.GameData.ObjectTypeToElement[id]; string type = node.Element("Class").Value; switch (type) { case "Projectile": throw new Exception("Projectile should not instantiated using Entity.Resolve"); case "Sign": return(new Sign(manager, id)); case "Wall": case "DoubleWall": return(new Wall(manager, id, node)); case "ConnectedWall": case "CaveWall": return(new ConnectedObject(manager, id)); case "GameObject": case "CharacterChanger": case "MoneyChanger": case "NameChanger": return(new StaticObject(manager, id, StaticObject.GetHP(node), true, false, true)); case "GuildRegister": case "GuildChronicle": case "GuildBoard": return(new StaticObject(manager, id, null, false, false, false)); case "Container": return(new Container(manager, id)); case "Player": throw new Exception("Player should not instantiated using Entity.Resolve"); case "Character": //Other characters means enemy return(new Enemy(manager, id)); case "ArenaPortal": case "Portal": return(new Portal(manager, id, null)); case "GuildHallPortal": return(new GuildHallPortal(manager, id, null)); case "ClosedVaultChest": return(new ClosedVaultChest(manager, id)); case "ClosedVaultChestGold": case "ClosedGiftChest": case "VaultChest": case "Merchant": return(new WorldMerchant(manager, id)); case "GuildMerchant": return(new GuildMerchant(manager, id)); case "ArenaGuard": case "MysteryBoxGround": case "ReskinVendor": case "PetUpgrader": case "FortuneTeller": case "YardUpgrader": case "FortuneGround": case "MarketNPC": case "BonesTheButcher": case "QuestRewards": return(new StaticObject(manager, id, null, true, false, false)); case "Pet": return(new Pet(manager, id)); default: Log.WarnFormat("Not supported type: {0}", type); return(new Entity(manager, id)); } }