Exemplo n.º 1
0
        public string[] to_string(int team, int ai_priority, int ai_mission)
        {
            if (!Generic)
            {
                string data = "";
                data += Actor_Id.ToString() + "|Actor ID\n";
                data += team.ToString() + "|Team\n";
                data += ai_priority.ToString() + "|AI Priority\n";
                data += ai_mission.ToString() + "|AI Mission";
                return(new string[] { "character", Identifier, data });
            }
            else
            {
                Game_Actor actor = null;
                // I don't quite understand this, aren't all generics temporary actors //Yeti
                bool is_temp_actor = false;
                if (Global.game_actors.ContainsKey(Actor_Id))
                {
                    actor = Global.game_actors[Actor_Id];
                }
                else if (Actor_Id >= 0)
                {
                    is_temp_actor  = true;
                    actor          = Global.game_actors[Actor_Id];
                    actor.class_id = Class_Id;
                    for (int i = 1; i < Global.weapon_types.Count; i++)
                    {
                        if (actor.weapon_level_cap(Global.weapon_types[i]) > 0)
                        {
                            actor.wexp_gain(Global.weapon_types[i], WLvls[i - 1]);
                        }
                    }
                }

                string data = "";
                data += Name.ToString() + "|Name\n";
                data += Class_Id.ToString() + "|Class ID\n";
                data += Gender.ToString() + "|Gender\n";
                data += Level.ToString() + "|Level\n";
                data += "0|Exp\n";
                data += team.ToString() + "|Team\n";
                data += Prepromote_Levels.ToString() + "|Prepromote Levels\n";
                data += ((int)Build).ToString() + "|Build Type\n";
                data += Con.ToString() + "|Con\n";
                data += ai_priority.ToString() + "|AI Priority\n";
                data += ai_mission.ToString() + "|AI Mission\n";
                for (int i = 0; i < Global.ActorConfig.NumItems; i++)
                {
                    int uses = -1; //Debug
                    //if (Items[i].Id > 0)
                    //{
                    //    uses = Items[i].max_uses;
                    //}
                    data += ((int)Items[i].Type).ToString() + ", " + Items[i].Id.ToString() + ", " + uses.ToString() + "|Item " + (i + 1).ToString() + "\n";
                }
                for (int i = 0; i < WLvls.Length; i++)
                {
                    if (WLvls[i] > 0 && actor != null && !actor.has_rank(Global.weapon_types[i + 1]))
                    {
                        data += "0";
                    }
                    else
                    {
                        data += WLvls[i].ToString();
                    }
                    if (i + 1 < WLvls.Length)
                    {
                        data += ", ";
                    }
                }

                if (is_temp_actor)
                {
                    Global.game_actors.temp_clear(Actor_Id);
                }
                return(new string[] { "generic", Identifier, data });
            }
        }