Inheritance: MonoBehaviour
 protected UIContext(ClientGame game, LocalPlayer localPlayer, PlayerGameObject playerGameObject)
 {
     this.game = game;
     this.localPlayer = localPlayer;
     this.localPlayer.PushUIContext(this);
     this.playerObject = playerGameObject;
 }
 public SoundComponent( Game game, Entity entity )
 {
     this.game = game;
     p = (LocalPlayer)entity;
     checkSoundNonSolid = CheckSoundNonSolid;
     checkSoundSolid = CheckSoundSolid;
 }
        public ClientGame(IPAddress serverAddress)
            : base()
        {
            this.localPlayer = new LocalPlayer(serverAddress, this);

            SetWorldSize m = localPlayer.DequeueIncomingTCP();
            this.SetWorldSize(m.WorldSize);
        }
 public static Guild GetInstance(LocalPlayer player)
 {
     Guild g = new Guild();
     g.name = Util.GetGuildProfileName();
     g.realm = player.RealmName;
     g.gold = Convert.ToInt64(Util.GetGuildMoney());
     //g.guildTabs = new List<ItemUnit>();
     return g;
 }
 public static Session GetInstance(LocalPlayer player, BotBase bot )
 {
     Session s = new Session();
     s.botBase = bot.Name;
     s.botDebug = "";
     s.map = player.CurrentMap.Name;
     s.id = 0;
     s.isEnd = 0;
     return s;
 }
 public SetCompanyPositions(LocalPlayer player, Company co, List<Vector2> positions)
 {
     this.Append(co.ID);
     this.Append(positions.Count);
     foreach (Vector2 pos in positions)
     {
         this.Append(pos);
     }
     player.SendTCP(this);
 }
        public override void OnClientInitialization(ClientGame game)
        {
            base.OnClientInitialization(game);
            this.clientGame = game;

            if (this.clientGame.LocalPlayer.Id == this.playerID.Value)
            {
                this.localPlayer = this.clientGame.LocalPlayer;
                this.clientGame.LocalPlayer.SetPlayerGameObject(this);
            }
        }
 public static Character GetInstance(LocalPlayer player)
 {
     Character c = new Character();
     c.id = 0;
     c.name = player.Name;
     c.level = player.Level;
     c.realm = player.RealmName;
     c.battlegroup = "Falta pegar";
     c.classe = player.Class.ToString();
     c.race = player.Race.ToString();
     c.guild = GuildFactory.GetInstance(player);
     return c;
 }
        public GameController(Engine _engine)
            : base(_engine)
        {
            Map map = StorageManager.Load(Engine);
            //Map map = new TestMap1(Engine, null);
            //Map map = new LoadedMap(Engine, null);
            Model playerModel = Engine.Content.Load<Model>("Models/tire");
            player = new LocalPlayer(Engine, Tracker, new Vector3(3f, 5f, 3f), playerModel);
            Engine.Map = map;

            playerCamera = new PlayerCamera(Engine, Tracker);
            debugCamera = new DebugCamera(Engine, Tracker, Vector3.Zero);
            mapEditor = new MapEditor(this, Tracker);
            playerCamera.Player = player;
            Engine.Camera = playerCamera;
        }
Beispiel #10
0
 private static string GetMana(LocalPlayer me)
 {
     //   Caster: 123 (42%)
     //   Rogue:  100 (CP = 0)
     //   Warr/DK: just rage or rp
     //   Druid: R = ##, E=##, (##%)
     switch (me.Class) {
         case WoWClass.Druid:
             return string.Format("R = {0}, E={1}, ({2}%)", me.CurrentRage, me.CurrentEnergy, (int)(me.ManaPercent));
         case WoWClass.Rogue:
             return string.Format("{0} (CP = {1})", me.CurrentEnergy, me.ComboPoints);
         case WoWClass.Warrior:
             return me.CurrentRage.ToString();
         case WoWClass.DeathKnight:
             return me.CurrentRunicPower.ToString();
         case WoWClass.Hunter:
             return me.CurrentFocus.ToString();
         default:
             return string.Format("{0} ({1}%)", me.CurrentMana, (int)(me.ManaPercent));
     }
 }
 internal void Play(LocalPlayer.PlayElements.PlayItem item)
 {
     string ext = Path.GetExtension(item.Path);
     switch (ext.ToUpper())
     {
         case ".AVI":
         case ".MP4":
         case ".MPG":
             ucVideoSurface.SetDuration(item.Duration);
             ucVideoSurface.PlayFile(item.Path);
             ucVideoSurface.BringToFront();
             break;
         case ".JPG":
         case ".PNG":
         case ".BMP":
             ucImageSurface.SetDuration(item.Duration);
             ucImageSurface.PlayFile(item.Path);
             ucImageSurface.BringToFront();
             break;
         default:
             break;
     }
 }
Beispiel #12
0
        static int _m_IsRemotePlayerFriend(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            xc.CommonInstanceState __cl_gen_to_be_invoked = (xc.CommonInstanceState)translator.FastGetCSObj(L, 1);


            try {
                {
                    LocalPlayer  local = (LocalPlayer)translator.GetObject(L, 2, typeof(LocalPlayer));
                    RemotePlayer actor = (RemotePlayer)translator.GetObject(L, 3, typeof(RemotePlayer));

                    bool __cl_gen_ret = __cl_gen_to_be_invoked.IsRemotePlayerFriend(local, actor);
                    LuaAPI.lua_pushboolean(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Beispiel #13
0
        public static bool Prefix(PlanetData planet)
        {
            // Run the original method if this is the master client
            if (LocalPlayer.IsMasterClient)
            {
                return(true);
            }

            // Check to make sure it's not already loaded
            if (planet.factoryLoaded || planet.factoryLoading)
            {
                return(false);
            }

            // They appear to have conveniently left this flag in for us, but they don't use it anywhere
            planet.factoryLoading = true;

            // Request factory
            Log.Info($"Requested factory for planet {planet.name} (ID: {planet.id}) from host");
            LocalPlayer.SendPacket(new FactoryLoadRequest(planet.id));

            // Skip running the actual method
            return(false);
        }
        public void UpdateChunks(double delta)
        {
            int chunkUpdates   = 0;
            int viewDist       = Utils.AdjViewDist(game.ViewDistance < 16 ? 16 : game.ViewDistance);
            int adjViewDistSqr = (viewDist + 24) * (viewDist + 24);

            chunksTarget += delta < targetTime ? 1 : -1;             // build more chunks if 30 FPS or over, otherwise slowdown.
            Utils.Clamp(ref chunksTarget, 4, 12);

            LocalPlayer p         = game.LocalPlayer;
            Vector3     cameraPos = game.CurrentCameraPos;
            bool        samePos   = cameraPos == lastCamPos && p.HeadYawDegrees == lastYaw &&
                                    p.PitchDegrees == lastPitch;

            renderer.renderCount = samePos ? UpdateChunksStill(delta, ref chunkUpdates, adjViewDistSqr) :
                                   UpdateChunksAndVisibility(delta, ref chunkUpdates, adjViewDistSqr);

            lastCamPos = cameraPos;
            lastYaw    = p.HeadYawDegrees; lastPitch = p.PitchDegrees;
            if (!samePos || chunkUpdates != 0)
            {
                ResetUsedFlags();
            }
        }
Beispiel #15
0
        public Status SwitchLogic()
        {
            LocalPlayer player = ObjectManager.Player;

            if (player.IsDead)
            {
                return(Status.DEAD);
            }
            else if (player.InGhostForm)
            {
                return(Status.GHOST);
            }
            else
            {
                if (ChoreBoy.NeedToMerchant() == true)
                {
                    return(Status.MERCHANTING);
                }
                else
                {
                    return(Status.ALIVE);
                }
            }
        }
        public void StartServer(int port)
        {
            PlayerManager   = new PlayerManager();
            PacketProcessor = new NetPacketProcessor();
#if DEBUG
            PacketProcessor.SimulateLatency = true;
#endif

            PacketUtils.RegisterAllPacketNestedTypes(PacketProcessor);
            PacketUtils.RegisterAllPacketProcessorsInCallingAssembly(PacketProcessor);

            socketServer = new WebSocketServer(port);
            socketServer.AddWebSocketService("/socket", () => new WebSocketService(PlayerManager, PacketProcessor));

            socketServer.Start();

            SimulatedWorld.Initialize();

            LocalPlayer.SetNetworkProvider(this);
            LocalPlayer.IsMasterClient = true;

            // TODO: Load saved player info here
            LocalPlayer.SetPlayerData(new PlayerData(PlayerManager.GetNextAvailablePlayerId(), GameMain.localPlanet?.id ?? -1, new Float3(1.0f, 0.6846404f, 0.243137181f)));
        }
Beispiel #17
0
        public static IEnumerable <CodeInstruction> PlayerActionMine_Transpiler(IEnumerable <CodeInstruction> instructions)
        {
            var codeMatcher = new CodeMatcher(instructions)
                              .MatchForward(true,
                                            new CodeMatch(OpCodes.Ldarg_0),
                                            new CodeMatch(OpCodes.Ldfld),
                                            new CodeMatch(OpCodes.Ldelema),
                                            new CodeMatch(OpCodes.Ldflda),
                                            new CodeMatch(OpCodes.Dup),
                                            new CodeMatch(OpCodes.Ldind_I4),
                                            new CodeMatch(OpCodes.Ldc_I4_1),
                                            new CodeMatch(OpCodes.Sub),
                                            new CodeMatch(OpCodes.Stind_I4));

            if (codeMatcher.IsInvalid)
            {
                NebulaModel.Logger.Log.Error("PlayerActionMine_Transpiler failed. Mod version not compatible with game version.");
                return(instructions);
            }

            return(codeMatcher
                   .Advance(1)
                   .InsertAndAdvance(new CodeInstruction(OpCodes.Ldarg_0))
                   .InsertAndAdvance(HarmonyLib.Transpilers.EmitDelegate <FetchVeinMineAmount>((FetchVeinMineAmount)((PlayerAction_Mine _this) =>
            {
                // do we need to check for the event here? its very unlikely that we call the GameTick() by hand...
                if (SimulatedWorld.Initialized && !PlanetManager.IsIncomingRequest)
                {
                    LocalPlayer.SendPacketToLocalStar(new VegeMinedPacket(_this.player.planetId, _this.miningId, _this.player.factory.veinPool[_this.miningId].amount, true));
                }

                return 0;
            })))
                   .Insert(new CodeInstruction(OpCodes.Pop))
                   .InstructionEnumeration());
        }
Beispiel #18
0
        public void Behavior()
        {
            LocalPlayer player = ObjectManager.Player;

            switch (SwitchLogic())
            {
            case Status.ALIVE:
                Pather.Traverse(Pather.GetNextHotspot());
                break;

            case Status.DEAD:
                player.RepopMe();
                break;

            case Status.GHOST:
                Pather.Traverse(player.CorpsePosition);
                player.RetrieveCorpse();
                break;

            case Status.MERCHANTING:
                ChoreBoy.PathToVendor();
                break;
            }
        }
 internal static byte GatheringStatus(this LocalPlayer player)
 {
     return(Core.Memory.Read <byte>(player.Pointer + Offsets.GatheringStateOffset));
 }
Beispiel #20
0
 public static void OnProductIconClick_Prefix(UIMinerWindow __instance)
 {
     LocalPlayer.SendPacketToLocalPlanet(new MinerStoragePickupPacket(__instance.minerId));
 }
 public SetSupplyPoint(LocalPlayer player, Base baseObj, Company co)
 {
     this.Append(baseObj.ID);
     this.Append(co.ID);
     player.SendTCP(this);
 }
Beispiel #22
0
        void ParseMetadata(NbtCompound children)
        {
            NbtCompound metadata = (NbtCompound)children["Metadata"].Value;
            NbtTag      cpeTag;
            LocalPlayer p = game.LocalPlayer;

            if (!metadata.TryGetValue("CPE", out cpeTag))
            {
                return;
            }

            metadata = (NbtCompound)cpeTag.Value;
            if (CheckKey("ClickDistance", 1, metadata))
            {
                p.ReachDistance = (short)curCpeExt["Distance"].Value / 32f;
            }
            if (CheckKey("EnvColors", 1, metadata))
            {
                map.Env.SetSkyColour(GetColour("Sky", WorldEnv.DefaultSkyColour));
                map.Env.SetCloudsColour(GetColour("Cloud", WorldEnv.DefaultCloudsColour));
                map.Env.SetFogColour(GetColour("Fog", WorldEnv.DefaultFogColour));
                map.Env.SetSunlight(GetColour("Sunlight", WorldEnv.DefaultSunlight));
                map.Env.SetShadowlight(GetColour("Ambient", WorldEnv.DefaultShadowlight));
            }
            if (CheckKey("EnvMapAppearance", 1, metadata))
            {
                string url = null;
                if (curCpeExt.ContainsKey("TextureURL"))
                {
                    url = (string)curCpeExt["TextureURL"].Value;
                }
                if (url.Length == 0)
                {
                    url = null;
                }
                if (game.UseServerTextures && url != null)
                {
                    game.Server.RetrieveTexturePack(url);
                }

                byte sidesBlock = (byte)curCpeExt["SideBlock"].Value;
                byte edgeBlock  = (byte)curCpeExt["EdgeBlock"].Value;
                map.Env.SetSidesBlock(sidesBlock);
                map.Env.SetEdgeBlock(edgeBlock);
                map.Env.SetEdgeLevel((short)curCpeExt["SideLevel"].Value);
            }
            if (CheckKey("EnvWeatherType", 1, metadata))
            {
                byte weather = (byte)curCpeExt["WeatherType"].Value;
                map.Env.SetWeather((Weather)weather);
            }

            if (game.UseCustomBlocks && CheckKey("BlockDefinitions", 1, metadata))
            {
                foreach (KeyValuePair <string, NbtTag> pair in curCpeExt)
                {
                    if (pair.Value.TagId != NbtTagType.Compound)
                    {
                        continue;
                    }
                    if (!Utils.CaselessStarts(pair.Key, "Block"))
                    {
                        continue;
                    }
                    ParseBlockDefinition((NbtCompound)pair.Value.Value);
                }
            }
        }
Beispiel #23
0
 public static void BeltPickupEnded()
 {
     LocalPlayer.SendPacketToLocalStar(new BeltUpdatePickupItemsPacket(BeltUpdates.ToArray(), GameMain.data.localPlanet.factoryIndex));
     BeltUpdates.Clear();
 }
 public RootContext(ClientGame game, LocalPlayer localPlayer, PlayerGameObject playerGameObject)
     : base(game, localPlayer, playerGameObject)
 {
 }
 public static bool HasDarkArts(this LocalPlayer me)
 {
     return(MagitekActionResourceManager.DarkKnight.DarkArts);
 }
Beispiel #26
0
            public Hashtable getItems(LocalPlayer Me)
            {
                Hashtable me = new Hashtable();
                using (Styx.StyxWoW.Memory.AcquireFrame())
                {

                    Hashtable items = new Hashtable();
                    List<WoWItem> its = Me.BagItems;
                    for (int i = 0; i < its.Count; i++)
                    {
                        items[its[i].Entry] = its[i].StackCount;
                    }
                    me["BagItems"] = items;

                    Hashtable items2 = new Hashtable();
                    WoWItem[] equipped = Me.Inventory.Equipped.Items;
                    for (int i = 0; i < equipped.Length; i++)
                    {
                        if (equipped[i] != null) items2[equipped[i].Entry] = equipped[i].DurabilityPercent;
                    }
                    me["EquippedItems"] = items2;
                }
                return me;
            }
 public BuildCombatVehicle(LocalPlayer player, Base baseObj)
 {
     this.Append(baseObj.ID);
     player.SendTCP(this);
 }
 public CreateCompany(LocalPlayer player)
 {
     player.SendTCP(this);
 }
Beispiel #29
0
        private static void _CheckLocalPlayer(NSError error)
        {
            var gkLocalPlayer = GKLocalPlayer.LocalPlayer();

            if (gkLocalPlayer.authenticated) {
                // create wrapper and dispatch event
                _localPlayer = NSObjectWrapper.CreateWrapper(typeof(LocalPlayer), gkLocalPlayer, gkLocalPlayer.playerID) as LocalPlayer;
                if (_localPlayerAuthenticatedHandlers != null)
                    _localPlayerAuthenticatedHandlers(null, EventArgs.Empty);

            } else {
                // set it to null and dispatch event
                _localPlayer = null;
                if (_localPlayerAuthenticationFailedHandlers != null)
                    _localPlayerAuthenticationFailedHandlers(null, new U3DXTErrorEventArgs(error));
            }
        }
Beispiel #30
0
        /// <summary>
        /// Authenticates the Game Center local player. Call this as soon as the game is initialized.
        /// <br></br>
        /// Raises the LocalPlayerAuthenticated and LocalPlayerAuthencationFailed events on completion.
        /// <br></br>
        /// Once the local player is authenticated, you can get the <c>LocalPlayer</c> property.
        /// </summary>
        public static void AuthenticateLocalPlayer()
        {
            var gkLocalPlayer = GKLocalPlayer.LocalPlayer();

            if (gkLocalPlayer.RespondsToSelector("authenticateHandler")) {
                // ios 6.0 new call
                gkLocalPlayer.authenticateHandler = delegate(UIViewController viewController, NSError error) {
                    if (viewController != null) {
                        _localPlayer = null;
                        UIApplication.SharedApplication().keyWindow.rootViewController.PresentViewController(viewController, true, null);
                    } else {
                        _CheckLocalPlayer(error);
                        error = null;
                    }
                };
            } else {
                // deprecated in ios 6.0
                gkLocalPlayer.Authenticate(delegate(NSError error) {
                    _CheckLocalPlayer(error);
                    error = null;
                });
            }
        }
Beispiel #31
0
            public Hashtable getGameStats(LocalPlayer Me)
            {
                Hashtable me = new Hashtable();

                    me["XPPerHour"] = Styx.CommonBot.GameStats.XPPerHour;
                    me["TimeToLevel"] = Styx.CommonBot.GameStats.TimeToLevel.TotalSeconds;
                    me["MobsKilled"] = Styx.CommonBot.GameStats.MobsKilled;
                    me["MobsPerHour"] = Styx.CommonBot.GameStats.MobsPerHour;
                    me["HonorGained"] = Styx.CommonBot.GameStats.HonorGained;
                    me["HonorPerHour"] = Styx.CommonBot.GameStats.HonorPerHour;
                    me["BGsWon"] = Styx.CommonBot.GameStats.BGsWon;
                    me["BGsLost"] = Styx.CommonBot.GameStats.BGsLost;

                return me;
            }
 public DeleteCompany(LocalPlayer player, Company co)
 {
     this.Append(co.ID);
     player.SendTCP(this);
 }
 public static bool HasAetherflow(this LocalPlayer me)
 {
     return(ActionResourceManager.Scholar.Aetherflow > 0);
 }
Beispiel #34
0
 public static bool TargetDistance(this LocalPlayer cp, float range, bool useMinRange = true)
 {
     return useMinRange ? cp.HasTarget && cp.Distance2D(cp.CurrentTarget) - cp.CombatReach - cp.CurrentTarget.CombatReach >= range
         : cp.HasTarget && cp.Distance2D(cp.CurrentTarget) - cp.CombatReach - cp.CurrentTarget.CombatReach <= range;
 }
 public static int EnemiesInCone(this LocalPlayer player, float maxdistance)
 {
     return(Combat.Enemies.Count(r => r.Distance(Core.Me) <= maxdistance + r.CombatReach && r.InView()));
 }
Beispiel #36
0
        /// <summary>
        /// 触发技能
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        bool TrggerSkill(uint skill_id)
        {
            LocalPlayer localPlayer = Game.GetInstance().GetLocalPlayer() as LocalPlayer;

            if (localPlayer == null)
            {
                return(false);
            }

            if (!localPlayer.IsResLoaded)
            {
                return(false);
            }

            Skill skill = localPlayer.GetSelfSkill(skill_id);

            if (skill == null)
            {
                return(false);
            }

            if (localPlayer.AttackCtrl.IsSkillCanCast_showTipsWhenFalse(skill, 0, ref m_tips_type) == false)
            {
                if (m_tips_type != ClickRockButtonTipsType.None)
                {
                    Dictionary <ClickRockButtonTipsType, float> m_tipsData;
                    if (m_clickRockButtonTips.TryGetValue(skill_id, out m_tipsData) == false)
                    {
                        m_clickRockButtonTips[skill_id] = new Dictionary <ClickRockButtonTipsType, float>();
                        m_tipsData = m_clickRockButtonTips[skill_id];
                    }
                    if (m_tipsData.ContainsKey(m_tips_type) == false)
                    {
                        m_tipsData[m_tips_type] = 0;
                    }
                    if (Time.realtimeSinceStartup >= m_tipsData[m_tips_type] + m_rockButtonTipsInterval)
                    {
                        m_tipsData[m_tips_type] = Time.realtimeSinceStartup;
                        if (m_tips_type == ClickRockButtonTipsType.IsInCD)
                        {
                            UINotice.GetInstance().ShowMessage(DBConstText.GetText("SKILL_IN_CD"));
                        }
                        else if (m_tips_type == ClickRockButtonTipsType.NotEnoughMp)
                        {
                            UINotice.GetInstance().ShowMessage(DBConstText.GetText("MP_NOT_ENOUGH"));
                        }
                    }
                }

                return(false);
            }

            bool needAi = false;

            if (skill.GetAction(0).ActionData.SkillInfo.Target == "rival")
            {
                needAi = true;
                //InstanceManager.Instance.IsInAutoFireOneSkillModel = true;
            }

            bool attack_succ = false;

            if (localPlayer.IsGrounded())
            {
                attack_succ = localPlayer.AttackCtrl.Attack(skill.SkillData.SkillID);

                localPlayer.MoveCtrl.Interrupt();
            }

            return(attack_succ);
        }
 public override void Patch(Harmony harmony)
 {
     player = NitroxServiceLocator.LocateService <LocalPlayer>();
     PatchMultiple(harmony, targetMethod, true, true, false, false);
 }
        public static List<ItemUnitChar> GetItensChar(LocalPlayer player, Int64 idChar)
        {
            List<WoWItem> l = player.BagItems;
            List<ItemUnitChar> li = new List<ItemUnitChar>();
            string itens = @"local tamanhoBag = 0
                            local tabelaCounts
                            local tabelaIds
                            local qtd, idItem, idBag, name, posicao, tamanho
                            local mt = {{}}
                            local pName = '{0}'
                            local pRealm = '{1}'
                            for k,v in pairs(DataStore_ContainersDB.global.Characters) do
                                posicao = strfind(k,pRealm)
                                tamanho = strlen(pRealm) + 1
                                if posicao ~= nil then
                                    name = string.sub(k,posicao+tamanho,50)
                                end
                                if name == pName then
                                    for k2,v2 in pairs(v) do
                                        if k2 == 'Containers' then
                                        for k3,v3 in pairs(v2) do
                                            tamanhoBag = v3['size']
                                            tabelaCounts = v3['counts']
                                            tabelaIds =  v3['ids']
                                            for Count = 1 , tamanhoBag, 1 do
                                                if tabelaIds[Count] ~= nil then
                                                    idItem = tabelaIds[Count]
                                                    if tabelaCounts[Count] == nil then
                                                    qtd = 1
                                                    else
                                                    qtd = tabelaCounts[Count]
                                                    end
                                                    if k3 ~= nil then
                                                    idBag = k3:gsub('Bag100', '-1')
                                                    idBag = idBag:gsub('Bag', '')
                                                    table.insert(mt, idBag .. '|' .. Count .. '|' .. idItem .. '|' .. qtd )
                                                    end
                                                end
                                            end
                                        end
                                        end
                                    end
                                end
                            end
                            return unpack(mt)";

            try
            {
                itens = String.Format(itens, player.Name, player.RealmName);
                List<string> luaRet = Lua.GetReturnValues(itens);

                Char c = new Char();
                c = Convert.ToChar("|");

                foreach (var item in luaRet)
                {

                    string[] it = item.Split(c);

                    ItemUnitChar itU = new ItemUnitChar();
                    itU.bagIndex = Convert.ToInt32(it[0]);
                    itU.bagSlot = Convert.ToInt32(it[1]);
                    itU.idItem = Convert.ToInt32(it[2]);
                    itU.stackCount = Convert.ToUInt32(it[3]);
                    itU.idChar = idChar;
                    li.Add(itU);
                }
                return li;
            }
            catch (Exception ex)
            {

                throw ex;
            }

            //foreach (WoWItem item in l)
            //{
            //    ItemUnitChar i = new ItemUnitChar();

            //    i.idItem = (int)item.ItemInfo.Id;
            //    i.stackCount = item.StackCount;
            //    i.bagSlot = item.BagSlot;
            //    i.bagIndex = item.BagIndex;
            //    i.idChar = idChar;
            //    li.Add(i);

            //}
        }
Beispiel #39
0
 public void Awake()
 {
     localPlayer = NitroxServiceLocator.LocateService<LocalPlayer>();
 }
Beispiel #40
0
 //public static bool IsInMeleeRange(this WoWUnit Unit, LocalPlayer me)
 //{
 //    return Unit.Distance < calculateMeleeRange(Unit, me);
 //}
 private static float calculateMeleeRange(WoWUnit Unit, LocalPlayer me)
 {
     return(!me.GotTarget ? 0f : Math.Max(5f, me.CombatReach + 1.3333334f + Unit.CombatReach));
 }
Beispiel #41
0
            /**
             *  Tries to get all stats, if one stat fails its not added.
             *
             */
            public Hashtable getAllStats(LocalPlayer Me)
            {
                Hashtable me = new Hashtable();

                try
                {
                    me["items"] = getItems(Me);
                }catch(Exception){ }
                try
                {
                    me["playerInfo"] = getPlayerInfo(Me);
                }
                catch (Exception) { }
                try
                {
                    me["gameStats"] = getGameStats(Me);
                }
                catch (Exception) { }

                return me;
            }
	public LocalPlayerAdapter(LocalPlayer p) {
		player = p;
	}
Beispiel #43
0
 public static bool IsWanding(this LocalPlayer me)
 {
     return(StyxWoW.Me.AutoRepeatingSpellId == 5019);
 }
 public static void OnCataButtonClick_Postfix(UIPowerGeneratorWindow __instance)
 {
     //Notify about changing amount of gravitational lens
     LocalPlayer.SendPacketToLocalStar(new RayReceiverChangeLensPacket(__instance.generatorId, __instance.powerSystem.genPool[__instance.generatorId].catalystPoint, GameMain.localPlanet?.factoryIndex ?? -1));
 }
Beispiel #45
0
        public static bool CanCast(AbilitySlot slot)
        {
            var abilityHudData = LocalPlayer.GetAbilityHudData(slot);

            return(abilityHudData != null && abilityHudData.CooldownLeft <= 0 && abilityHudData.EnergyCost <= EntitiesManager.LocalPlayer.Energized.Energy);
        }
 public override void Patch(Harmony harmony)
 {
     localPlayer         = NitroxServiceLocator.LocateService <LocalPlayer>();
     simulationOwnership = NitroxServiceLocator.LocateService <SimulationOwnership>();
     PatchPostfix(harmony, TARGET_METHOD);
 }
 public static void OnGammaMode2Click_Postfix(UIPowerGeneratorWindow __instance)
 {
     //Notify about change of ray receiver to mode "produce photons"
     LocalPlayer.SendPacketToLocalStar(new RayReceiverChangeModePacket(__instance.generatorId, RayReceiverMode.Photon, GameMain.localPlanet?.factoryIndex ?? -1));
 }
Beispiel #48
0
            public Hashtable getPlayerInfo(LocalPlayer Me)
            {
                Hashtable me = new Hashtable();

                    me["Level"] = Me.Level;
                    me["Experience"] = Me.Experience;

                    me["NextLevelExperience"] = Me.NextLevelExperience;
                    me["Durability"] = Me.Durability;
                    me["DurabilityPercent"] = Me.DurabilityPercent;
                    me["FreeBagSlots"] = Me.FreeBagSlots;

                    Hashtable loc = new Hashtable();
                    loc["X"] = Me.X;
                    loc["Y"] = Me.Y;
                    loc["Z"] = Me.Z;
                    loc["ZoneText"] = Me.ZoneText;

                    Hashtable currency = new Hashtable();
                    currency["Copper"] = Me.Copper;
                    currency["HonorPoints"] = Styx.WoWInternals.WoWCurrency.GetCurrencyByType(WoWCurrencyType.HonorPoints).Amount;
                    currency["ConquestPoints"] = Styx.WoWInternals.WoWCurrency.GetCurrencyByType(WoWCurrencyType.ConquestPoints).Amount;
                    currency["JusticePoints"] = Styx.WoWInternals.WoWCurrency.GetCurrencyByType(WoWCurrencyType.JusticePoints).Amount;
                    currency["ValorPoints"] = Styx.WoWInternals.WoWCurrency.GetCurrencyByType(WoWCurrencyType.ValorPoints).Amount;

                    me["Currency"] = currency;
                    me["WorldLocation"] = loc;
                return me;
            }
 private InputSourceManager()
 {
     P1_InputSource = new LocalPlayer(true);
     P2_InputSource = new LocalPlayer(false);
 }
 public AddCombatVehicleToCompany(LocalPlayer player, Company co, CombatVehicle vic)
 {
     this.Append(co.ID);
     this.Append(vic.ID);
     player.SendTCP(this);
 }
Beispiel #51
0
        public override void Tick(ScheduledTask task)
        {
            if (Disconnected)
            {
                return;
            }
            if (connecting)
            {
                TickConnect(); return;
            }

            if ((DateTime.UtcNow - lastPacket).TotalSeconds >= 30)
            {
                CheckDisconnection(task.Interval);
            }
            if (Disconnected)
            {
                return;
            }

            try {
                reader.ReadPendingData();
            } catch (SocketException ex) {
                ErrorHandler.LogError("reading packets", ex);
                game.Disconnect("&eLost connection to the server", "I/O error when reading packets");
                return;
            }

            while ((reader.size - reader.index) > 0)
            {
                byte opcode = reader.buffer[reader.index];
                // Workaround for older D3 servers which wrote one byte too many for HackControl packets.
                if (cpeData.needD3Fix && lastOpcode == Opcode.CpeHackControl && (opcode == 0x00 || opcode == 0xFF))
                {
                    Utils.LogDebug("Skipping invalid HackControl byte from D3 server.");
                    reader.Skip(1);

                    LocalPlayer player = game.LocalPlayer;
                    player.physics.jumpVel       = 0.42f;               // assume default jump height
                    player.physics.serverJumpVel = player.physics.jumpVel;
                    continue;
                }

                if (opcode >= handlers.Length)
                {
                    game.Disconnect("Disconnected!", "Server sent invalid packet " + opcode + "!"); return;
                }
                if ((reader.size - reader.index) < packetSizes[opcode])
                {
                    break;
                }

                reader.Skip(1);                 // remove opcode
                lastOpcode = opcode;
                lastPacket = DateTime.UtcNow;

                Action handler = handlers[opcode];
                if (handler == null)
                {
                    game.Disconnect("Disconnected!", "Server sent invalid packet " + opcode + "!"); return;
                }
                handler();
            }

            reader.RemoveProcessed();
            // Network is ticked 60 times a second. We only send position updates 20 times a second.
            if ((netTicks % 3) == 0)
            {
                CoreTick();
            }
            netTicks++;
        }
Beispiel #52
0
        public static void OnItemButtonClick_Prefix(UILabWindow __instance, int index)
        {
            if (!SimulatedWorld.Initialized)
            {
                return;
            }

            LabComponent labComponent = GameMain.localPlanet.factory.factorySystem.labPool[__instance.labId];

            if (labComponent.researchMode)
            {
                if (GameMain.mainPlayer.inhandItemId > 0 && GameMain.mainPlayer.inhandItemCount > 0)
                {
                    //Notify about depositing source cubes
                    ItemProto[] matrixProtos = (ItemProto[])AccessTools.Field(typeof(UILabWindow), "matrixProtos").GetValue(__instance);
                    int         id           = matrixProtos[index].ID;
                    if (GameMain.mainPlayer.inhandItemId == id)
                    {
                        int num  = labComponent.matrixServed[index] / 3600;
                        int num2 = 100 - num;
                        if (num2 < 0)
                        {
                            num2 = 0;
                        }
                        int num3 = (GameMain.mainPlayer.inhandItemCount >= num2) ? num2 : GameMain.mainPlayer.inhandItemCount;
                        if (num3 > 0)
                        {
                            LocalPlayer.SendPacketToLocalStar(new LaboratoryUpdateCubesPacket(labComponent.matrixServed[index] + num3 * 3600, index, __instance.labId, GameMain.localPlanet?.id ?? -1));
                        }
                    }
                }
                else
                {
                    //Notify about widthrawing source cubes
                    if ((int)(labComponent.matrixServed[index] / 3600) > 0)
                    {
                        LocalPlayer.SendPacketToLocalStar(new LaboratoryUpdateCubesPacket(0, index, __instance.labId, GameMain.localPlanet?.id ?? -1));
                    }
                }
            }
            else if (labComponent.matrixMode)
            {
                if (GameMain.mainPlayer.inhandItemId > 0 && GameMain.mainPlayer.inhandItemCount > 0)
                {
                    //Notify about depositing source items to the center
                    int num7 = labComponent.served[index];
                    int num8 = 100 - num7;
                    if (num8 < 0)
                    {
                        num8 = 0;
                    }
                    int num9 = (GameMain.mainPlayer.inhandItemCount >= num8) ? num8 : GameMain.mainPlayer.inhandItemCount;
                    if (num9 > 0)
                    {
                        LocalPlayer.SendPacketToLocalStar(new LaboratoryUpdateStoragePacket(labComponent.served[index] + num9, index, __instance.labId, GameMain.localPlanet?.id ?? -1));
                    }
                }
                else
                {
                    //Notify about withdrawing source items from the center
                    if (labComponent.served[index] > 0)
                    {
                        LocalPlayer.SendPacketToLocalStar(new LaboratoryUpdateStoragePacket(0, index, __instance.labId, GameMain.localPlanet?.id ?? -1));
                    }
                }
            }
            else
            {
                //Notify about changing matrix selection
                LocalPlayer.SendPacketToLocalStar(new LaboratoryUpdateEventPacket(index, __instance.labId, GameMain.localPlanet?.id ?? -1));
            }
        }
Beispiel #53
0
 public static bool UnitDistance(this LocalPlayer cp, GameObject unit, float range, bool useMinRange = true)
 {
     return useMinRange ? cp.Distance2D(unit) - cp.CombatReach - unit.CombatReach >= range
         : cp.Distance2D(unit) - cp.CombatReach - unit.CombatReach <= range;
 }
 public BuildTransport(LocalPlayer player, Base baseObj)
 {
     this.Append(baseObj.ID);
     player.SendTCP(this);
 }
Beispiel #55
0
        public void Traverse(Location destination)
        {
            LocalPlayer player = ObjectManager.Player;

            player.CtmTo(Path(destination));
        }
 public AddTransportVehicleToCompany(LocalPlayer player, Company co, Transport vic)
 {
     this.Append(co.ID);
     this.Append(vic.ID);
     player.SendTCP(this);
 }
Beispiel #57
0
        public override void Execute()
        {
            bool develop_mode      = false;
            bool CreepHasBeenFound = false;
            bool fixCamera         = false;
            int  allyIndex         = 2;

            bot.log("waiting for league of legends process...");

            if (!develop_mode)
            {
                bot.wait(95000);
            }
            bot.log("waiting done");
            if (bot.isProcessOpen(GAME_PROCESS_NAME))
            {
                bot.waitProcessOpen(GAME_PROCESS_NAME);
                bot.log("Champion selected, loading game...");

                bot.waitUntilProcessBounds(GAME_PROCESS_NAME, 1030, 797);
                bot.wait(200);

                bot.log("waiting for game to load.");

                bot.bringProcessToFront(GAME_PROCESS_NAME);
                bot.centerProcess(GAME_PROCESS_NAME);

                game.waitUntilGameStart();

                bot.log("We are in game!");
                string championName = LocalPlayer.GetChampionName();
                bot.log(championName + " picked.");
                bot.bringProcessToFront(GAME_PROCESS_NAME);
                bot.centerProcess(GAME_PROCESS_NAME);

                bot.wait(1000);

                game.detectSide();

                if (game.getSide() == SideEnum.Blue)
                {
                    CastTargetPoint = new Point(1084, 398);
                    bot.log("We are blue side!");
                }
                else
                {
                    CastTargetPoint = new Point(644, 761);
                    bot.log("We are red side!");
                }

                bot.wait(1000);

                game.player.setLevel(0);

                #region items


                Item[] items =
                {
                    new Item("Vampiric Scepter",     900, false, false, 0, game.shop.getItemPosition(ShopItemTypeEnum.Early,     1)),
                    new Item("Long Sword",           350, false, false, 0, game.shop.getItemPosition(ShopItemTypeEnum.Early,     0)),
                    new Item("Berserker's Greaves", 1100, false, false, 0, game.shop.getItemPosition(ShopItemTypeEnum.Essential, 2)),
                    new Item("B.F. Sword",          1300, false, false, 0, game.shop.getItemPosition(ShopItemTypeEnum.Offensive, 1)),
                    new Item("Bloodthirster",       3500, false, false, 0, game.shop.getItemPosition(ShopItemTypeEnum.Offensive, 2)),
                    new Item("B.F. Sword",          1300, false, false, 0, game.shop.getItemPosition(ShopItemTypeEnum.Offensive, 1)),
                    new Item("Infinity Edge",       3400, false, false, 0, game.shop.getItemPosition(ShopItemTypeEnum.Defensive, 2)),
                    new Item("Statikk Shiv",        2600, false, false, 0, game.shop.getItemPosition(ShopItemTypeEnum.Defensive, 0)),
                    new Item("Frozen Mallet",       3100, false, false, 0, game.shop.getItemPosition(ShopItemTypeEnum.Defensive, 1)),
                };

                //if want another itemset, just copy and paste and change SELECTED_CHAMPION_SET value

                #endregion

                List <Item> itemsToBuy = new List <Item>(items);

                game.shop.setItemBuild(itemsToBuy);

                game.shop.toogle();

                bot.wait(2000);
                game.shop.fixItemsInShop();
                bot.wait(1000);
                game.shop.buyItem(1);
                game.shop.toogle();

                if (!develop_mode)
                {
                    bot.wait(3000); //wait 3 seconds.
                }
                //if (fixCamera)
                //{
                //   cameraFix();
                //}

                game.player.lockcamera();

                game.player.moveNearestBotlaneAllyTower();
                bot.wait(3000);

                while (bot.isProcessOpen(GAME_PROCESS_NAME))  // Game loop
                {
                    bot.bringProcessToFront(GAME_PROCESS_NAME);
                    bot.centerProcess(GAME_PROCESS_NAME);


                    if (game.player.getCharacterLeveled())
                    {
                        game.player.increaseLevel();
                        game.player.upSpells(); //Change order on MainPlayer.cs
                    }

                    int health = game.player.getHealthPercent();

                    //back base/buy
                    if (health <= 50)
                    {
                        //heal usage if is available
                        if (game.player.isThereAnEnemy())
                        {
                            game.player.heal();
                        }
                    }

                    if (health <= 88)
                    {
                        //heal usage if is available
                        if (game.player.isThereAnEnemy())
                        {
                            game.player.heal();
                        }
                    }

                    if (health <= 25)
                    {
                        game.player.heal();
                    }

                    //getting attacked by enemy, tower or creep.

                    if (game.player.isThereAnAllyCreep())
                    {
                        //attack enemy and run away
                        if (game.player.isThereAnEnemy())
                        {
                            game.player.combo();
                            game.player.moveAwayFromEnemy();
                        }
                        else
                        {
                            if (game.player.isThereAnEnemyCreep())
                            {
                                game.player.harras();
                                game.player.moveAwayFromCreep();
                            }
                            bot.wait(100);
                            game.player.allyCreepPosition();
                            CreepHasBeenFound = true;
                        }
                    }
                    else
                    {
                        // Just run away, no allies to find.
                        if (game.player.dead())
                        {
                            //low hp.
                            game.player.justMoveAway();
                            bot.wait(2000);
                            //game.player.backBaseRegenerateAndBuy();
                            // read gold.
                            game.shop.toogle();
                            game.shop.tryBuyItem();
                            game.shop.toogle();
                            bot.wait(200);
                            while (game.player.dead())
                            {
                                bot.log("Player dead.Waiting for player alive");
                                bot.wait(1000);
                            }
                            game.player.moveNearestBotlaneAllyTower();
                            bot.wait(2000);
                            //prevent getting stucked by doing it again
                            game.player.moveNearestBotlaneAllyTower();
                        }

                        if (game.player.isThereAnEnemy())
                        {
                            game.player.combo();
                            game.player.moveAwayFromEnemy();
                        }

                        if (game.player.isThereAnEnemyCreep())
                        {
                            game.player.harras();
                            game.player.moveAwayFromCreep();
                        }

                        if (!game.player.isThereAnAllyCreep() && !game.player.isThereAnEnemy() && !game.player.nearTowerStructure() && !game.player.isThereAnEnemyCreep())
                        {
                            bot.log("Creeps not found or your images are wrong.");
                            if (game.player.tryMoveLightArea(1397, 683, "#65898F"))
                            {
                            }
                            else if (game.player.tryMoveLightArea(966, 630, "#65898F"))
                            {
                            }
                            else if (game.player.tryMoveLightArea(1444, 813, "#919970"))
                            {
                            }
                            else
                            {
                                if (CreepHasBeenFound)
                                {
                                    game.camera.lockAlly(allyIndex);
                                }
                                else
                                {
                                    allyIndex = incAllyIndex(allyIndex);

                                    bot.wait(5000);
                                }


                                game.moveCenterScreen();
                                if (!game.player.isThereAnAllyCreep() || !game.player.isThereAnEnemyCreep()) //if player just afks, change index.
                                {
                                    allyIndex = incAllyIndex(allyIndex);
                                }

                                bot.wait(500);
                            }
                        }
                    }
                }

                bot.executePattern("EndCoop");
            }
            else
            {
                bot.log("game not load");
                bot.executePattern("StartCoop");
            }
        }
Beispiel #58
0
        public void Update()
        {
            //If the game processes is not running, close the cheat.
            if (!ProcUtils.ProcessIsRunning(Program.GameProcess))
                Environment.Exit(0);

            WindowTitle = GetActiveWindowTitle();
            if (WindowTitle != Program.GameTitle)
                return;

            var players = new List<Tuple<int, Player>>();
            var entities = new List<Tuple<int, BaseEntity>>();
            var weapons = new List<Tuple<int, Weapon>>();

            State = (SignOnState) Program.MemUtils.Read<int>((IntPtr) (ClientState + Offsets.ClientState.InGame));
            _localPlayer = Program.MemUtils.Read<int>((IntPtr) (ClientDllBase + Offsets.Misc.LocalPlayer));
            ViewMatrix = Program.MemUtils.ReadMatrix((IntPtr) _viewMatrix, 4, 4);


            //If we are not ingame do not update  
            if (State != SignOnState.SignonstateFull)
                return;

            var data = new byte[16*8192];
            Program.MemUtils.Read((IntPtr) _entityList, out data, data.Length);

            for (var i = 0; i < data.Length/16; i++)
            {
                var address = BitConverter.ToInt32(data, 16*i);
                if (address == 0) continue;
                var entity = new BaseEntity(address);
                if (!entity.IsValid())
                    continue;
                if (entity.IsPlayer())
                    players.Add(new Tuple<int, Player>(i, new Player(entity)));
                else if (entity.IsWeapon())
                    weapons.Add(new Tuple<int, Weapon>(i, new Weapon(entity)));
                else
                    entities.Add(new Tuple<int, BaseEntity>(i, entity));
            }

            Players = players.ToArray();
            Entities = entities.ToArray();
            Weapons = weapons.ToArray();

            //Check if our player exists
            if (players.Exists(x => x.Item2.Address == _localPlayer))
            {
                LocalPlayer = new LocalPlayer(players.First(x => x.Item2.Address == _localPlayer).Item2);
                LocalPlayerWeapon = LocalPlayer.GetActiveWeapon();
                //Only gets the weapon name and formates it properly and retunrs a string. Used for Weapon Configs
                WeaponSection = LocalPlayer.GetActiveWeaponName();
            }
        }