예제 #1
0
        static public object DEV_HealGroup(string data)
        {
            var v = GroupSelectionManager.Get().GetSelectedGroup();

            if (v == null)
            {
                Debug.LogError("[ERROR]this script requires selected group");
                return(null);
            }


            if (v != null)
            {
                var group = EntityManager.Get <Thea2.Server.Group>(v.GetID());
                if (group.characters == null)
                {
                    return(null);
                }


                foreach (var character in group.characters)
                {
                    character.Get().HealFully();
                }

                group.NewTurnRefresh();

                //request update / changes made to the group
                NOCSRequestGroupDetails.ServerSelfRequestOneGroup(v.GetID());
            }

            return(null);
        }
예제 #2
0
        static public object DEV_AddToxines(string data)
        {
            var v = GroupSelectionManager.Get().GetSelectedGroup();

            if (v == null)
            {
                Debug.LogError("[ERROR]this script requires selected group");
                return(null);
            }

            if (v != null)
            {
                var group = EntityManager.Get <Thea2.Server.Group>(v.GetID());
                if (group.characters == null)
                {
                    return(null);
                }

                SkillPack sp = Globals.GetInstanceFromDB <SkillPack>(SKILL_PACK.TOXINE);

                foreach (var c in group.characters)
                {
                    c.Get().AddSkillEffect(sp, false, 5);
                }

                //request update / changes made to the group
                NOCSRequestGroupDetails.ServerSelfRequestOneGroup(v.GetID());
            }

            return(null);
        }
예제 #3
0
        static public object DEV_AddMP(string data)
        {
            var v = GroupSelectionManager.Get().GetSelectedGroup();

            if (v == null)
            {
                Debug.LogError("[ERROR]this script requires selected group");
                return(null);
            }

            int c = 10;

            if (!string.IsNullOrEmpty(data))
            {
                try
                {
                    c = Convert.ToInt32(data);
                }
                catch
                {
                    Debug.LogError("[ERROR]data was not a number! " + data);
                }
            }

            if (v != null && c > 0)
            {
                var group = EntityManager.Get <Thea2.Server.Group>(v.GetID());
                if (group.characters == null)
                {
                    return(null);
                }


                Tag mp = (Tag)TAG.MOVEMENT_RANGE;
                //Tag mp2 = Globals.GetInstanceFromDB<Tag>("TAG-MOVEMENT_RANGE");   // alternative method to access Tag

                foreach (var character in group.characters)
                {
                    character.Get().attributes.AddToBase(mp, c, true);
                    character.Get().attributes.GetFinal(mp);
                }

                group.NewTurnRefresh();

                //request update / changes made to the group
                NOCSRequestGroupDetails.ServerSelfRequestOneGroup(v.GetID());
            }

            return(null);
        }
예제 #4
0
        static public object DEV_AddXP(string data)
        {
            var v = GroupSelectionManager.Get().GetSelectedGroup();

            if (v == null)
            {
                Debug.LogError("[ERROR]this script requires selected group");
                return(null);
            }

            int c = 10;

            if (!string.IsNullOrEmpty(data))
            {
                try
                {
                    c = Convert.ToInt32(data);
                }
                catch
                {
                    Debug.LogError("[ERROR]data was not a number! " + data);
                }
            }

            if (v != null && c > 0)
            {
                var group = EntityManager.Get <Thea2.Server.Group>(v.GetID());
                if (group.characters == null)
                {
                    return(null);
                }

                foreach (var character in group.characters)
                {
                    character.Get().Xp = character.Get().Xp + c;
                }

                //request update / changes made to the group
                NOCSRequestGroupDetails.ServerSelfRequestOneGroup(v.GetID());
            }
            return(null);
        }
예제 #5
0
        static public object DEV_AddResources(string data)
        {
            var v = GroupSelectionManager.Get().GetSelectedGroup();

            if (v == null)
            {
                Debug.LogError("[ERROR]this script requires selected group");
                return(null);
            }

            int c = 10;

            if (!string.IsNullOrEmpty(data))
            {
                try
                {
                    c = Convert.ToInt32(data);
                }
                catch
                {
                    Debug.LogError("[ERROR]data was not a number! " + data);
                }
            }

            if (v != null && c > 0)
            {
                var group = EntityManager.Get <Thea2.Server.Group>(v.GetID());

                foreach (var r in ItemBase.resourceToItem)
                {
                    group.AddItem(r.Value.Clone <ItemResource>(true), c, true);
                }

                //request update / changes made to the group
                NOCSRequestGroupDetails.ServerSelfRequestOneGroup(v.GetID());
            }

            return(null);
        }
예제 #6
0
        static public object DEV_Add(string data)
        {
            var v = GroupSelectionManager.Get().GetSelectedGroup();

            if (v == null || string.IsNullOrEmpty(data))
            {
                Debug.LogError("[ERROR]this script requires selected group and data containing Item cargo ID or subrace");
                return(null);
            }

            if (v != null)
            {
                var group = EntityManager.Get <Thea2.Server.Group>(v.GetID());
                if (group == null)
                {
                    Debug.LogError("[ERROR]Group not found");
                    return(null);
                }

                for (int i = 0; i < 40; i++)
                {
                    var b = Globals.GetInstanceFromDB(data);

                    if (b is ItemCargo)
                    {
                        ItemCargo ic = b as ItemCargo;
                        group.AddItem(ItemBase.InstantaiteFrom(ic));
                    }
                    else if (b is Subrace)
                    {
                        Character.Instantiate(group, b as Subrace, 1);
                    }
                }
                //request update / changes made to the group
                NOCSRequestGroupDetails.ServerSelfRequestOneGroup(v.GetID());
            }

            return(null);
        }
예제 #7
0
        static public object DEV_DebugSelectedGroup(string data)
        {
            var v = GroupSelectionManager.Get().GetSelectedGroup();

            if (v == null)
            {
                Debug.LogError("[ERROR]this script requires selected group");
                return(null);
            }

            Thea2.Server.Group g = EntityManager.Get <Thea2.Server.Group>(v.GetID());

            HoneyDebug.DebugGroups(g);

            if (g != null && g.characters != null)
            {
                StringBuilder sb = new StringBuilder();

                foreach (var c in g.characters)
                {
                    Character ch = c.Get();
                    sb.AppendLine("Name: " + ch.name);

                    var d = ch.attributes.GetFinalDictionary();
                    foreach (var a in d)
                    {
                        sb.AppendLine(a.Key.Get().dbName + " : " + a.Value.ToString(true));
                    }

                    sb.AppendLine("-------------");
                }

                Debug.Log(sb.ToString());
            }

            return(null);
        }
        static bool Prefix(Equip __instance)
        {
            if (__instance.name == "Remove Character")
            {
                Dictionary <UIManager.Screen, List <ScreenBase> > openScreensByEnum = Traverse.Create(UIManager.Get()).Field("openScreensByEnum").GetValue <Dictionary <UIManager.Screen, List <ScreenBase> > >();

                //Closes Equip and Navbar to return to HUD
                if (UIManager.Get() != null && openScreensByEnum != null)
                {
                    foreach (KeyValuePair <UIManager.Screen, List <ScreenBase> > keyValuePair in openScreensByEnum)
                    {
                        if (keyValuePair.Value != null && keyValuePair.Value.Count >= 1)
                        {
                            List <ScreenBase> list = new List <ScreenBase>(keyValuePair.Value);
                            foreach (ScreenBase screenBase in list)
                            {
                                if (!(screenBase is TopLayer) && screenBase.name != "HUD(Clone)")
                                {
                                    UIManager.Close(screenBase);
                                }
                            }
                        }
                    }
                }

                //Clones "Giving up people" to simplify it and allow character to be removed without gaining items/rep with the slavyans
                AdvModule  advModule    = Array.Find <AdvModule>(AdventureLibrary.modules, (AdvModule o) => o.name == "Slavyan");
                AdvEvent[] advEventList = Array.FindAll <AdvEvent>(advModule.events, (AdvEvent o) => o.name == "Generic Remove Character");
                AdvEvent   advEvent;
                if (advEventList.GetLength(0) == 0)
                {
                    advEvent        = Array.FindAll <AdvEvent>(advModule.events, (AdvEvent o) => o.name == "Giving up people")[0].Clone();
                    advEvent.module = advModule;
                    advEvent.name   = "Generic Remove Character";
                    Array.Resize <AdvEvent>(ref advModule.events, advModule.events.Length + 1);
                    advModule.events[advModule.events.Length - 1] = advEvent;
                    //advEvent.uniqueID = advModule.GetNextEventIndex(); //Might not be necessary to add ID since it will be removed later
                    UnityEngine.Debug.Log("Equip_ButtonClick_Patch --------------------- making new event " + advEvent.name);
                }
                else
                {
                    //In case the temporary event already exists, but I'm removing them after the event ends
                    advEvent = advEventList[0];
                }

                //Modifies the event to make it more generic and simple
                AdvNode[] nodes = advEvent.nodes;
                foreach (AdvNode node in nodes)
                {
                    if (node is NodeAdventure)
                    {
                        (node as NodeAdventure).story = "You approach your group to decide if anyone should leave.";
                    }
                    List <AdvOutput> outputs = node.outputs;
                    if (outputs != null)
                    {
                        foreach (AdvOutput output in outputs)
                        {
                            if (output.name == "Wish them well and leave.")
                            {
                                output.name = "Send someone away.";
                            }
                            if (output.name == "Actually, ask them to stay with you!")
                            {
                                output.name = "Nevermind.";
                            }
                            if (output.name == "Confirm")
                            {
                                output.targetID = 5;
                            }
                            if (output.name == "Cancel")
                            {
                                output.targetID = 5;
                            }
                        }
                    }
                }

                //Run the new temporary event
                ClientGroupData    selectedGroup = GroupSelectionManager.Get().GetSelectedGroup();
                Thea2.Server.Group group         = null;
                if (selectedGroup != null)
                {
                    group = EntityManager.Get <Thea2.Server.Group>(selectedGroup.GetID(), true);
                }
                AdventureManager adventureManager = AdventureManager.TriggerEvent(group.ownerID, advEvent, group, null, -1, true);

                return(false);
            }

            return(true);
        }