public override void Execute(Level level) { ClientAvatar ca = level.GetPlayerAvatar(); GameObject go = level.GameObjectManager.GetGameObjectByID(m_vBuildingId); if (go != null) { if (go.ClassId == 4) { Trap t = (Trap)go; int upgradeLevel = t.GetUpgradeLevel(); var rd = t.GetTrapData().GetBuildResource(upgradeLevel); int sellPrice = t.GetTrapData().GetSellPrice(upgradeLevel); ca.CommodityCountChangeHelper(0, rd, sellPrice); level.GameObjectManager.RemoveGameObject(t); } else if (go.ClassId == 6) { Deco d = (Deco)go; var rd = d.GetDecoData().GetBuildResource(); int sellPrice = d.GetDecoData().GetSellPrice(); if (rd.PremiumCurrency) { ca.SetDiamonds(ca.GetDiamonds() + sellPrice); } else { ca.CommodityCountChangeHelper(0, rd, sellPrice); } level.GameObjectManager.RemoveGameObject(d); } else { //TODO BUILDING /* * Building b = (Building)go; * level.GameObjectManager.RemoveGameObject(b); * */ } } }
public override void Execute(Level level) { ClientAvatar avatar = level.GetPlayerAvatar(); GameObject gameObjectById = level.GameObjectManager.GetGameObjectByID(m_vBuildingId); if (gameObjectById == null) { return; } if (gameObjectById.ClassId == 4) { Trap trap = (Trap)gameObjectById; int upgradeLevel = trap.GetUpgradeLevel(); ResourceData buildResource = trap.GetTrapData().GetBuildResource(upgradeLevel); int sellPrice = trap.GetTrapData().GetSellPrice(upgradeLevel); avatar.CommodityCountChangeHelper(0, (Data)buildResource, sellPrice); level.GameObjectManager.RemoveGameObject((GameObject)trap); } else { if (gameObjectById.ClassId != 6) { return; } Deco deco = (Deco)gameObjectById; ResourceData buildResource = deco.GetDecoData().GetBuildResource(); int sellPrice = deco.GetDecoData().GetSellPrice(); if (buildResource.PremiumCurrency) { avatar.SetDiamonds(avatar.GetDiamonds() + sellPrice); } else { avatar.CommodityCountChangeHelper(0, (Data)buildResource, sellPrice); } level.GameObjectManager.RemoveGameObject((GameObject)deco); } }
public override void Execute(Level level) { ClientAvatar avatar = level.GetPlayerAvatar(); TrapData dataById = (TrapData)CSVManager.DataTables.GetDataById(TrapId); Trap trap = new Trap((Data)dataById, level); if (!avatar.HasEnoughResources(dataById.GetBuildResource(0), dataById.GetBuildCost(0)) || level.HasFreeWorkers()) { return; } ResourceData buildResource = dataById.GetBuildResource(0); avatar.CommodityCountChangeHelper(0, (Data)buildResource, -dataById.GetBuildCost(0)); trap.StartConstructing(X, Y); level.GameObjectManager.AddGameObject((GameObject)trap); }
public override void Execute(Level level) { ClientAvatar ca = level.GetPlayerAvatar(); DecoData dd = (DecoData)CSVManager.DataTables.GetDataById(DecoId); if (ca.HasEnoughResources(dd.GetBuildResource(), dd.GetBuildCost())) { ResourceData rd = dd.GetBuildResource(); ca.CommodityCountChangeHelper(0, rd, -dd.GetBuildCost()); Deco d = new Deco(dd, level); d.SetPositionXY(X, Y, level.GetPlayerAvatar().GetActiveLayout()); level.GameObjectManager.AddGameObject(d); } }
internal override void Process() { ClientAvatar ca = this.Device.Player.Avatar; DecoData dd = (DecoData)CSVManager.DataTables.GetDataById(DecoId); if (ca.HasEnoughResources(dd.GetBuildResource(), dd.GetBuildCost())) { ResourceData rd = dd.GetBuildResource(); ca.CommodityCountChangeHelper(0, rd, -dd.GetBuildCost()); Deco d = new Deco(dd, this.Device.Player); d.SetPositionXY(X, Y, this.Device.Player.Avatar.m_vActiveLayout); this.Device.Player.GameObjectManager.AddGameObject(d); } }
public override void Execute(Level level) { ClientAvatar avatar = level.GetPlayerAvatar(); DecoData dataById = (DecoData)CSVManager.DataTables.GetDataById(DecoId); if (!avatar.HasEnoughResources(dataById.GetBuildResource(), dataById.GetBuildCost())) { return; } ResourceData buildResource = dataById.GetBuildResource(); avatar.CommodityCountChangeHelper(0, (Data)buildResource, -dataById.GetBuildCost()); Deco deco = new Deco((Data)dataById, level); deco.SetPositionXY(X, Y, level.GetPlayerAvatar().GetActiveLayout()); level.GameObjectManager.AddGameObject((GameObject)deco); }
public override void Execute(Level level) { ClientAvatar ca = level.GetPlayerAvatar(); TrapData td = (TrapData)ObjectManager.DataTables.GetDataById(TrapId); Trap t = new Trap(td, level); if (ca.HasEnoughResources(td.GetBuildResource(0), td.GetBuildCost(0))) { if (level.HasFreeWorkers()) { ResourceData rd = td.GetBuildResource(0); ca.CommodityCountChangeHelper(0, rd, -td.GetBuildCost(0)); t.StartConstructing(X, Y); level.GameObjectManager.AddGameObject(t); } } }
} //00 00 2D 7F some client tick public override void Execute(Level level) { ClientAvatar ca = level.GetPlayerAvatar(); BuildingData bd = (BuildingData)ObjectManager.DataTables.GetDataById(BuildingId); Building b = new Building(bd, level); if (ca.HasEnoughResources(bd.GetBuildResource(0), bd.GetBuildCost(0))) { if (bd.IsWorkerBuilding() || level.HasFreeWorkers()) { //Ajouter un check sur le réservoir d'élixir noir ResourceData rd = bd.GetBuildResource(0); ca.CommodityCountChangeHelper(0, rd, -bd.GetBuildCost(0)); b.StartConstructing(X, Y); level.GameObjectManager.AddGameObject(b); } } }
public override void Execute(Level level) { if (Depth >= 10) { //TODO: Block Exploitor's IP. ResourcesManager.DropClient(level.GetClient().GetSocketHandle()); } else { ResourceData dataById = (ResourceData)CSVManager.DataTables.GetDataById(m_vResourceId); if (dataById == null || m_vResourceCount < 1 || dataById.PremiumCurrency) { return; } ClientAvatar avatar = level.GetPlayerAvatar(); int resourceDiamondCost = GamePlayUtil.GetResourceDiamondCost(m_vResourceCount, dataById); if (m_vResourceCount > avatar.GetUnusedResourceCap(dataById) || !avatar.HasEnoughDiamonds(resourceDiamondCost)) { return; } avatar.UseDiamonds(resourceDiamondCost); avatar.CommodityCountChangeHelper(0, (Data)dataById, m_vResourceCount); if (!m_vIsCommandEmbedded) { return; } if (m_vIsCommandEmbedded && m_vCommand != null) { var cmd = (Command)m_vCommand; cmd.Execute(level); } } }