Beispiel #1
0
        public void SkillInit(NodeParent node)
        {
            DrawSkill(node);
            RPGPlayer  rPGPlayer = Main.player[Main.myPlayer].GetModPlayer <RPGPlayer>();
            NodeParent neightboor;

            for (int j = 0; j < node.GetNeightboor.Count; j++)
            {
                neightboor = node.GetNeightboor[j];
                if (node.GetNeightboor.Exists(x => x.ID == neightboor.ID) && !(node.connectedNeighboor.Exists(x => x.ID == neightboor.ID)))
                {
                    if (!(neightboor.GetNodeType == NodeType.LimitBreak && rPGPlayer.GetLevel() < 1000 || neightboor.GetNode.GetAscended && !skillTree.IsLimitBreak()))
                    {
                        DrawConnection((neightboor.GetActivate || node.GetActivate) ? Color.GreenYellow : Color.Gray, node.menuPos, neightboor.menuPos, node, neightboor);
                        node.connectedNeighboor.Add(neightboor);
                        neightboor.connectedNeighboor.Add(node);
                    }
                }
            }

            int listSize = allConnection.Count;

            for (int i = 0; i < listSize; i++)
            {
                backGround.Append(allConnection[i]);
            }
            listSize = allBasePanel.Count;
            for (int i = 0; i < listSize; i++)
            {
                backGround.Append(allBasePanel[i]);
            }
        }
        private float GetClassDamage(DamageType _type)
        {
            float     value   = 1;
            RPGPlayer pEntity = Main.player[Main.myPlayer].GetModPlayer <RPGPlayer>();

            if (ActiveClass == null)
            {
                return(1);
            }
            JsonChrClass actualClass = JsonCharacterClass.GetJsonCharList.GetClass(ActiveClass.GetClassType);

            value *= 1 + actualClass.Damage[(int)_type];
            if (_type == DamageType.Ranged)
            {
                if (pEntity.HaveBow())
                {
                    value *= 1 + actualClass.Damage[5];
                }
                if (pEntity.HaveRangedWeapon() && !pEntity.HaveBow())
                {
                    value *= 1 + actualClass.Damage[6];
                }
            }
            return(value);
        }
 public void Disable(RPGPlayer p)
 {
     if (p.GetskillTree.ActiveClass == this)
     {
         p.GetskillTree.ActiveClass = null;
     }
     enable = false;
 }
Beispiel #4
0
    /// <summary>
    /// 添加到战场
    /// </summary>
    public void AddPlayerToBattle(RPGCharacter ch)
    {
        UnityEngine.Assertions.Assert.AreEqual(ch.GetCamp(), EnumCharacterCamp.Player);
        RPGPlayer player = ch as RPGPlayer;

        players.Players.Add(player);
        players.PlayersLogic.Add(player.Logic);
    }
Beispiel #5
0
    // Use this for initialization
    void Start()
    {
        // Start the music
        SoundManager.PlayBackgroundMusic(SoundManager.BackgroundMusic.Battle_Music);

        // Load the the tilemap file
        GameTileMapReference.Load(SaveClass.GetPlayerPrefString(SaveClass.Save_Keys.Key_Level), 15);

        // Set up the objective
        setObjective();

        // Load Player Settings
        playerSetting = GetComponent <PlayerSettings>();
        playerSetting.Load();

        // Load weapons on player
        // Player 1
        RPGPlayer player = PlayerList[0];
        Weapon    weapon = null;

        // Left weapon
        weapon = Instantiate(LeftWeapons[SaveClass.GetPlayerPrefInt(SaveClass.Save_Keys.Key_Player1_Left)]);
        weapon.transform.parent     = player.transform;
        weapon.transform.position   = player.transform.position;
        weapon.transform.localScale = new Vector3(1, 1, 1);
        player.LeftWeapon           = weapon;
        // Right weapon
        weapon = Instantiate(RightWeapons[SaveClass.GetPlayerPrefInt(SaveClass.Save_Keys.Key_Player1_Right)]);
        weapon.transform.parent     = player.transform;
        weapon.transform.position   = player.transform.position;
        weapon.transform.localScale = new Vector3(1, 1, 1);
        player.RightWeapon          = weapon;
        // Load Skin
        player.PlayerSkin = playerSetting.CurrentFirstSkin;

        // Player 2
        player = PlayerList[1];
        // Left weapon
        weapon = Instantiate(LeftWeapons[SaveClass.GetPlayerPrefInt(SaveClass.Save_Keys.Key_Player2_Left)]);
        weapon.transform.parent     = player.transform;
        weapon.transform.position   = player.transform.position;
        weapon.transform.localScale = new Vector3(1, 1, 1);
        player.LeftWeapon           = weapon;
        // Right weapon
        weapon = Instantiate(RightWeapons[SaveClass.GetPlayerPrefInt(SaveClass.Save_Keys.Key_Player2_Right)]);
        weapon.transform.parent     = player.transform;
        weapon.transform.position   = player.transform.position;
        weapon.transform.localScale = new Vector3(1, 1, 1);
        player.RightWeapon          = weapon;
        // Load Skin
        // -- Special Case for Second Player as we don't want to override the default skin
        if (playerSetting.CurrentSecondSkin != null)
        {
            player.PlayerSkin = playerSetting.CurrentSecondSkin;
        }
    }
Beispiel #6
0
    protected override void OnTriggerEnter2D(Collider2D other)
    {
        RPGPlayer player = other.gameObject.GetComponent <RPGPlayer>();

        if (player != null)
        {
            player.Heal(Healing);
        }
        base.OnTriggerEnter2D(other);
    }
Beispiel #7
0
        public void Init()
        {
            //Erase all previous value
            Erase();
            sizeMultplier = Zoom * UIScale * ScreenMult;
            skillTree.ResetConnection();
            allConnection = new List <Connection>();
            allBasePanel  = new List <SkillPanel>();
            allText       = new List <SkillText>();



            backGround = new UIPanel();
            backGround.SetPadding(0);
            backGround.Left.Set(0, 0f);
            backGround.Top.Set(0, 0f);
            backGround.Width.Set(Main.screenWidth, 0f);
            backGround.Height.Set(Main.screenHeight, 0f);
            backGround.BackgroundColor = new Color(73, 94, 171, 150);
            Append(backGround);

            RPGPlayer rPGPlayer = Main.player[Main.myPlayer].GetModPlayer <RPGPlayer>();

            skillPointsLeft = new UIText("Skill Points : " + rPGPlayer.GetSkillPoints + " / " + (rPGPlayer.GetLevel() - 1));
            skillPointsLeft.Left.Set(150, 0f);
            skillPointsLeft.Top.Set(150, 0f);
            backGround.Append(skillPointsLeft);

            ResetText = new UIText("RESET", 1 * ScreenMult, true)
            {
                TextColor = Color.Gray
            };
            ResetText.Left.Set(150 * ScreenMult, 0f);
            ResetText.Top.Set(250 * ScreenMult, 0f);
            ResetText.Width.Set(0, 0f);
            ResetText.Height.Set(0, 0f);
            ResetText.OnClick     += new MouseEvent(ResetStats);
            ResetText.OnMouseOver += new MouseEvent(ResetTextHover);
            ResetText.OnMouseOut  += new MouseEvent(ResetTextOut);
            backGround.Append(ResetText);

            backGround.OnMouseDown   += new UIElement.MouseEvent(DragStart);
            backGround.OnMouseUp     += new UIElement.MouseEvent(DragEnd);
            backGround.OnScrollWheel += new ScrollWheelEvent(ScrollUpDown);

            Instance = this;
            for (int i = 0; i < skillTree.nodeList.nodeList.Count; i++)
            {
                SkillInit(skillTree.nodeList.nodeList[i]);
            }



            //
        }
Beispiel #8
0
    public static RPGPlayer Create(int id, CharacterAttribute customAttribute = null)
    {
        PlayerDef def = ResourceManager.GetPlayerDef(id);
        RPGPlayer r   = new RPGPlayer(def);

        if (customAttribute != null)
        {
            r.logic.SetAttribute(customAttribute);
        }
        return(r);
    }
Beispiel #9
0
        private void ResetStats(UIMouseEvent evt, UIElement listeningElement)
        {
            if (!visible)
            {
                return;
            }
            Main.PlaySound(SoundID.MenuOpen);
            RPGPlayer rPGPlayer = Main.player[Main.myPlayer].GetModPlayer <RPGPlayer>();

            rPGPlayer.ResetSkillTree();
            rPGPlayer.GetskillTree.Init();
            dragging = false;
            LoadSkillTree();
        }
        public override void Action(CommandCaller caller, string input, string[] args)
        {
            RPGPlayer character = caller.Player.GetModPlayer <RPGPlayer>();
            int       level     = Int32.Parse(args[0]);

            level = Mathf.Clamp(level, 0, 9999);

            character.ResetSkillTree();

            for (int i = 0; i < level; i++)
            {
                character.commandLevelup();
            }
        }
Beispiel #11
0
    protected override void OnTriggerEnter2D(Collider2D other)
    {
        RPGPlayer player = other.gameObject.GetComponent <RPGPlayer>();

        if (player != null)
        {
            if (Manager)
            {
                Manager.NotifyCoinCollected(CoinAmount);
            }
            player.PlayerSettingsReference.AddCoins(CoinAmount);
        }
        base.OnTriggerEnter2D(other);
    }
Beispiel #12
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            RPGPlayer player   = Main.player[Main.myPlayer].GetModPlayer <RPGPlayer>();
            float     quotient = 1f;

            //Calculate quotient


            quotient = (float)player.GetStatXP(stat) / (float)player.GetStatXPMax(stat);

            this.Width.Set(quotient * width, 0f);
            //Left.Set((1 - quotient) * width, 0);
            Recalculate(); // recalculate the position and size

            base.Draw(spriteBatch);
        }
Beispiel #13
0
    /// <summary>
    /// 载入事件数据,加载我方和敌方数据,并加载单位到战场上。
    /// </summary>
    /// <param name="slot"></param>
    public void LoadBattleData(int slot)
    {
        Clear();
        BattleInfoCollection data = record.LoadBattleFromDisk(slot);

        //Debug.Log(collect.Event.TurnEvent[0].SequenceName);
        ChapterDef = ResourceManager.GetChapterDef(data.CurrentTeam.Chapter);
        gameMode.LoadTileMap(data.MapID);
        players.PlayersLogic.Clear();
        foreach (var v in data.CurrentTeamPlayerInfo)
        {
            RPGPlayer p = RPGPlayer.Create(v);
            players.PlayersLogic.Add(p.Logic);
            gameMode.BattlePlayer.AddUnitToMap(p, v.tileCoords);
        }
    }
Beispiel #14
0
 public override void OnEnter()
 {
     if (UseDefaultAttribute)
     {
         Attribute = null;
     }
     if (Camp == EnumCharacterCamp.Player)
     {
         RPGCharacter ch = RPGPlayer.Create(ID, Attribute);
         gameMode.BattlePlayer.AddUnitToMap(ch, Coord);
     }
     if (Camp == EnumCharacterCamp.Enemy)
     {
         RPGCharacter ch = RPGEnemy.Create(ID, Attribute);
         gameMode.BattlePlayer.AddUnitToMap(ch, Coord);
     }
     Continue();
 }
        public override void Action(CommandCaller caller, string input, string[] args)
        {
            Player    player    = caller.Player;
            RPGPlayer character = player.GetModPlayer <RPGPlayer>();

            if (args.Length == 0)
            {
                Main.NewText(Description);
                return;
            }
            if (int.TryParse(args[0], out int slot) == false)
            {
                Main.NewText("Slot Number invalid");
                return;
            }
            ItemUpdate item   = player.HeldItem.GetGlobalItem <ItemUpdate>();
            ItemUpdate Source = player.inventory[slot].GetGlobalItem <ItemUpdate>();

            Main.NewText(player.inventory[slot].Name);
        }
        public override void ToggleEnable()
        {
            base.ToggleEnable();

            if (enable)
            {
                Main.player[Main.myPlayer].GetModPlayer <RPGPlayer>().GetskillTree.ActiveClass = this;
            }
            else
            {
                Main.player[Main.myPlayer].GetModPlayer <RPGPlayer>().GetskillTree.ActiveClass = null;
            }

            RPGPlayer player = Main.player[Main.myPlayer].GetModPlayer <RPGPlayer>();


            UpdateClass();
            if (Main.netMode == NetmodeID.MultiplayerClient)
            {
                player.SendClientChanges(player);
            }
        }
Beispiel #17
0
        public override void Update(GameTime gameTime)
        {
            int listSize = allConnection.Count;

            for (int i = 0; i < listSize; i++)
            {
                allConnection[i].Left.Set((allConnection[i].basePos.X + offSet.X) * sizeMultplier, 0);
                allConnection[i].Top.Set((allConnection[i].basePos.Y + offSet.Y) * sizeMultplier, 0);
            }
            listSize = allBasePanel.Count;
            for (int i = 0; i < listSize; i++)
            {
                allBasePanel[i].Left.Set((allBasePanel[i].basePos.X + offSet.X) * sizeMultplier, 0);
                allBasePanel[i].Top.Set((allBasePanel[i].basePos.Y + offSet.Y) * sizeMultplier, 0);
            }

            RPGPlayer rPGPlayer = Main.player[Main.myPlayer].GetModPlayer <RPGPlayer>();

            skillPointsLeft.SetText("Skill Points : " + rPGPlayer.GetSkillPoints + " / " + (rPGPlayer.GetLevel() - 1));

            Recalculate();
        }
Beispiel #18
0
        private void OnClickNode(UIMouseEvent evt, UIElement listeningElement, NodeParent node)
        {
            if (node.GetActivate)
            {
                if (node.GetNodeType == NodeType.Class)
                {
                    node.ToggleEnable();

                    UpdateValue();
                    if (node.GetEnable == false)
                    {
                        Main.PlaySound(SoundID.MenuClose);
                    }
                    else
                    {
                        Main.PlaySound(SoundID.MenuOpen);
                    }
                    return;
                }
            }

            RPGPlayer rPGPlayer = Main.player[Main.myPlayer].GetModPlayer <RPGPlayer>();

            switch (node.CanUpgrade(rPGPlayer.GetSkillPoints, rPGPlayer.GetLevel()))
            {
            case Reason.CanUpgrade:
                rPGPlayer.SpentSkillPoints(node.GetCostPerLevel);
                node.Upgrade();
                UpdateToolTip(node);
                UpdateValue();
                Main.PlaySound(SoundID.MenuOpen);
                break;

            default:
                Main.PlaySound(SoundID.MenuClose);
                break;
            }
        }
        public override void Action(CommandCaller caller, string input, string[] args)
        {
            Player    player    = caller.Player;
            RPGPlayer character = player.GetModPlayer <RPGPlayer>();

            if (args.Length == 0)
            {
                Main.NewText(Description);
                return;
            }
            if (int.TryParse(args[0], out int slot) == false)
            {
                Main.NewText("Slot Number invalid");
                return;
            }
            ItemUpdate item   = player.HeldItem.GetGlobalItem <ItemUpdate>();
            ItemUpdate Source = player.inventory[slot].GetGlobalItem <ItemUpdate>();

            if (item == Source)
            {
                Main.NewText("Slot number And Held Items are the same");
                return;
            }


            AnotherRpgMod.source    = Source;
            AnotherRpgMod.Transfer  = item;
            AnotherRpgMod.XPTvalueA = ItemExtraction.GetTotalEarnedXp(Source);
            AnotherRpgMod.XPTvalueB = ItemExtraction.GetTotalEarnedXp(item);

            float xp = ItemExtraction.GetExtractedXp(false, Source);

            Main.NewText("Transfering " + xp + " exp from " + player.inventory[slot].Name + " to " + player.HeldItem.Name);

            Source.ResetLevelXp();
            item.xPTransfer(xp, player, player.HeldItem);
        }
Beispiel #20
0
        private void OnCollisionEnter2D(Collision2D other)
        {
            RPGPlayer  player = other.gameObject.GetComponent <RPGPlayer>();
            Projectile proj   = other.gameObject.GetComponent <Projectile>();
            Sword      sword  = other.gameObject.GetComponent <Sword>();

            if (player != null)
            {
                player.Injure(EnemyDamage);
            }
            else if (proj != null)
            {
                // Injury from Projectile
                Injure(proj.Damage);

                // Remove the Projectile
                proj.Disable();
            }
            //Collided with Sword
            else if (sword != null)
            {
                Injure(sword.Damage);
            }
        }
        public override void Action(CommandCaller caller, string input, string[] args)
        {
            Player    player    = caller.Player;
            RPGPlayer character = player.GetModPlayer <RPGPlayer>();

            if (AnotherRpgMod.source == null)
            {
                return;
            }
            if (AnotherRpgMod.Transfer == null)
            {
                return;
            }

            AnotherRpgMod.source.ResetLevelXp(false);
            AnotherRpgMod.Transfer.ResetLevelXp(false);
            AnotherRpgMod.source.SilentxPTransfer(AnotherRpgMod.XPTvalueA);
            AnotherRpgMod.Transfer.SilentxPTransfer(AnotherRpgMod.XPTvalueB);

            AnotherRpgMod.source    = null;
            AnotherRpgMod.Transfer  = null;
            AnotherRpgMod.XPTvalueA = 0;
            AnotherRpgMod.XPTvalueB = 0;
        }
        static public void HandlePacket(BinaryReader reader, int whoAmI)
        {
            Message msg = (Message)reader.ReadByte();
            Dictionary <DataTag, object> tags = new Dictionary <DataTag, object>();

            foreach (DataTag tag in dataTags[msg])
            {
                tags.Add(tag, tag.read(reader));
            }
            switch (msg)
            {
            case Message.SyncLevel:
                RPGPlayer p = Main.player[(int)tags[DataTag.playerId]].GetModPlayer <RPGPlayer>();
                if (p.baseName == "")
                {
                    p.baseName = Main.player[(int)tags[DataTag.playerId]].name;
                }


                if ((int)tags[DataTag.playerId] != Main.myPlayer)
                {
                    if (Main.netMode != NetmodeID.SinglePlayer)
                    {
                        p.SyncLevel((int)tags[DataTag.amount]);
                    }
                    Main.player[(int)tags[DataTag.playerId]].name = p.baseName + " The Lvl." + p.GetLevel() + " " + (string)tags[DataTag.buffer];
                }

                break;

            case Message.AddXP:
                Main.LocalPlayer.GetModPlayer <RPGPlayer>().AddXp((int)tags[DataTag.amount], (int)tags[DataTag.level]);
                break;

            case Message.SyncNPCSpawn:
                if (Main.netMode == NetmodeID.MultiplayerClient)
                {
                    NPC npc = Main.npc[(int)tags[DataTag.npcId]];

                    if (npc.GetGlobalNPC <ARPGGlobalNPC>() == null)
                    {
                        AnotherRpgMod.Instance.Logger.Info(npc.GivenName);
                    }

                    //npc.SetDefaults(npc.type);
                    if (npc.GetGlobalNPC <ARPGGlobalNPC>().StatsCreated == true)
                    {
                        return;
                    }
                    int     tier  = (int)tags[DataTag.tier];
                    int     level = (int)tags[DataTag.level];
                    NPCRank rank  = (NPCRank)tags[DataTag.rank];

                    NPCModifier modifiers = (NPCModifier)tags[DataTag.modifiers];
                    if (npc == null || npc.GetGlobalNPC <ARPGGlobalNPC>() == null)
                    {
                        return;
                    }
                    AnotherRpgMod.Instance.Logger.Info(npc.GivenOrTypeName + "\nTier : " + tier + "   Level : " + level + "   rank : " + rank + "   Modifier  : " + modifiers + " \n Buffer : " + (string)tags[DataTag.buffer]);

                    Dictionary <string, string> bufferStack = Unparse((string)tags[DataTag.buffer]);

                    WorldManager.BossDefeated = (int)tags[DataTag.WorldTier];

                    npc.GetGlobalNPC <ARPGGlobalNPC>().StatsCreated = true;
                    npc.GetGlobalNPC <ARPGGlobalNPC>().modifier     = modifiers;
                    npc.GetGlobalNPC <ARPGGlobalNPC>().SetLevelTier(level, tier, (byte)rank);
                    npc.GetGlobalNPC <ARPGGlobalNPC>().specialBuffer = bufferStack;

                    npc.GetGlobalNPC <ARPGGlobalNPC>().SetStats(npc);

                    npc.GivenName = NPCUtils.GetNpcNameChange(npc, tier, level, rank);



                    //AnotherRpgMod.Instance.Logger.Info("NPC created with id : " + npc.whoAmI);
                    //AnotherRpgMod.Instance.Logger.Info( "Client Side : \n" + npc.GetGivenOrTypeNetName() + "\nLvl." + (npc.GetGlobalNPC<ARPGGlobalNPC>().getLevel + npc.GetGlobalNPC<ARPGGlobalNPC>().getTier) + "\nHealth : " + npc.life + " / " + npc.lifeMax + "\nDamage : " + npc.damage + "\nDef : " + npc.defense + "\nTier : " + npc.GetGlobalNPC<ARPGGlobalNPC>().getRank + "\n\n");
                }
                break;

            case Message.SyncNPCUpdate:
                if (Main.netMode == NetmodeID.MultiplayerClient)
                {
                    NPC npcu = Main.npc[(int)tags[DataTag.npcId]];

                    if (npcu.lifeMax != (int)tags[DataTag.maxLife] || npcu.life != (int)tags[DataTag.life])
                    {
                        AnotherRpgMod.Instance.Logger.Warn("DESYNC ERROR SPOTTED FOR : ");
                        AnotherRpgMod.Instance.Logger.Warn(npcu.GivenOrTypeName + "\n" + (int)tags[DataTag.life] + " / " + (int)tags[DataTag.maxLife] + "\n" + npcu.life + " / " + npcu.lifeMax);
                    }
                    Main.npc[(int)tags[DataTag.npcId]].lifeMax = (int)tags[DataTag.maxLife];
                    Main.npc[(int)tags[DataTag.npcId]].life    = (int)tags[DataTag.life];
                }
                break;

            case Message.Log:
                if (Main.netMode == NetmodeID.MultiplayerClient)
                {
                    //ErrorLogger.Log("LOG FROM SERVER");
                    AnotherRpgMod.Instance.Logger.Info((string)tags[DataTag.buffer]);
                }

                break;

            case Message.AskNpc:
                if (Main.netMode == NetmodeID.Server)
                {
                    NPC npc = Main.npc[(int)tags[DataTag.npcId]];
                    if (npc.GetGlobalNPC <ARPGGlobalNPC>() == null)
                    {
                        return;
                    }
                    int tier  = npc.GetGlobalNPC <ARPGGlobalNPC>().getTier;
                    int level = npc.GetGlobalNPC <ARPGGlobalNPC>().getLevel;
                    int rank  = npc.GetGlobalNPC <ARPGGlobalNPC>().getRank;
                    Mod mod   = AnotherRpgMod.Instance;
                    //MPDebug.Log(mod, "Server Side : \n" + npc.GetGivenOrTypeNetName() + " ID : " + npc.whoAmI + "\nLvl." + (npc.GetGlobalNPC<ARPGGlobalNPC>().getLevel + npc.GetGlobalNPC<ARPGGlobalNPC>().getTier) + "\nHealth : " + npc.life + " / " + npc.lifeMax + "\nDamage : " + npc.damage + "\nDef : " + npc.defense + "\nTier : " + npc.GetGlobalNPC<ARPGGlobalNPC>().getRank + "\n");

                    SendNpcSpawn(mod, npc, tier, level, npc.GetGlobalNPC <ARPGGlobalNPC>());
                }
                break;
            }
        }
        public override void Action(CommandCaller caller, string input, string[] args)
        {
            Player    player    = caller.Player;
            RPGPlayer character = player.GetModPlayer <RPGPlayer>(mod);

            ItemUpdate item      = player.HeldItem.GetGlobalItem <ItemUpdate>();
            float      itemvalue = player.HeldItem.value;
            int        cost      = Mathf.RoundInt((itemvalue * 0.33333f));

            AnotherRpgMod.Instance.Logger.Info(cost);

            if (player.CanBuyItem(cost))
            {
                player.BuyItem(cost);
                int plat = 0;
                int gold = 0;
                int silv = 0;
                int copp = 0;

                int costbuffer = cost;
                if (costbuffer >= 1000000)
                {
                    plat       = costbuffer / 1000000;
                    costbuffer = -plat * 1000000;
                }

                if (costbuffer > 10000)
                {
                    gold       = costbuffer / 10000;
                    costbuffer = -gold * 10000;
                }

                if (costbuffer > 100)
                {
                    silv       = costbuffer / 100;
                    costbuffer = -silv * 100;
                }

                if (costbuffer > 1)
                {
                    copp = costbuffer;
                }

                string coststring = "";

                if (plat > 0)
                {
                    coststring += " " + plat + " " + Lang.inter[15].Value;
                }
                if (gold > 0)
                {
                    coststring += " " + gold + " " + Lang.inter[16].Value;
                }
                if (silv > 0)
                {
                    coststring += " " + silv + " " + Lang.inter[17].Value;
                }
                if (copp > 0)
                {
                    coststring += " " + copp + " " + Lang.inter[18].Value;
                }
                coststring += " used to reroll your item rarity";
                Main.NewText(coststring);

                item.Roll(caller.Player.HeldItem);
            }
            else
            {
                int plat = 0;
                int gold = 0;
                int silv = 0;
                int copp = 0;

                int costbuffer = cost;
                if (costbuffer >= 1000000)
                {
                    plat       = costbuffer / 1000000;
                    costbuffer = -plat * 1000000;
                }

                if (costbuffer > 10000)
                {
                    gold       = costbuffer / 10000;
                    costbuffer = -gold * 10000;
                }

                if (costbuffer > 100)
                {
                    silv       = costbuffer / 100;
                    costbuffer = -silv * 100;
                }

                if (costbuffer > 1)
                {
                    copp = costbuffer;
                }

                string coststring = "need";

                if (plat > 0)
                {
                    coststring += " " + plat + " " + Lang.inter[15].Value;
                }
                if (gold > 0)
                {
                    coststring += " " + gold + " " + Lang.inter[16].Value;
                }
                if (silv > 0)
                {
                    coststring += " " + silv + " " + Lang.inter[17].Value;
                }
                if (copp > 0)
                {
                    coststring += " " + copp + " " + Lang.inter[18].Value;
                }
                coststring += " to reroll your item rarity";
                Main.NewText(coststring);
            }
        }
	void Start () {
        _battle = FindObjectOfType<RPGBattle>();
        _player = _battle._player;
        _enemy = _battle._enemy;
	}
Beispiel #25
0
    public static RPGPlayer Create(CharacterInfo info)
    {
        RPGPlayer r = new RPGPlayer(info);

        return(r);
    }
Beispiel #26
0
 public void LoadChar()
 {
     Char = Main.player[Main.myPlayer].GetModPlayer <RPGPlayer>();
 }
        public override void Action(CommandCaller caller, string input, string[] args)
        {
            Player    player    = caller.Player;
            RPGPlayer character = player.GetModPlayer <RPGPlayer>();

            ItemUpdate item = player.HeldItem.GetGlobalItem <ItemUpdate>();
            int        cost = player.HeldItem.value;

            if (player.CanBuyItem(cost))
            {
                player.BuyItem(cost);

                int plat = 0;
                int gold = 0;
                int silv = 0;
                int copp = 0;

                int costbuffer = cost;
                if (costbuffer >= 1000000)
                {
                    plat       = costbuffer / 1000000;
                    costbuffer = -plat * 1000000;
                }

                if (costbuffer > 10000)
                {
                    gold       = costbuffer / 10000;
                    costbuffer = -gold * 10000;
                }

                if (costbuffer > 100)
                {
                    silv       = costbuffer / 100;
                    costbuffer = -silv * 100;
                }

                if (costbuffer > 1)
                {
                    copp = costbuffer;
                }

                string coststring = "";

                if (plat > 0)
                {
                    coststring += " " + plat + " " + Lang.inter[15].Value;
                }
                if (gold > 0)
                {
                    coststring += " " + gold + " " + Lang.inter[16].Value;
                }
                if (silv > 0)
                {
                    coststring += " " + silv + " " + Lang.inter[17].Value;
                }
                if (copp > 0)
                {
                    coststring += " " + copp + " " + Lang.inter[18].Value;
                }
                coststring += " used to reroll your item evolution tree";
                Main.NewText(coststring);

                item.CompleteReset();
            }
            else
            {
                int plat = 0;
                int gold = 0;
                int silv = 0;
                int copp = 0;

                int costbuffer = cost;
                if (costbuffer >= 1000000)
                {
                    plat       = costbuffer / 1000000;
                    costbuffer = -plat * 1000000;
                }

                if (costbuffer > 10000)
                {
                    gold       = costbuffer / 10000;
                    costbuffer = -gold * 10000;
                }

                if (costbuffer > 100)
                {
                    silv       = costbuffer / 100;
                    costbuffer = -silv * 100;
                }

                if (costbuffer > 1)
                {
                    copp = costbuffer;
                }

                string coststring = "need";

                if (plat > 0)
                {
                    coststring += " " + plat + " " + Lang.inter[15].Value;
                }
                if (gold > 0)
                {
                    coststring += " " + gold + " " + Lang.inter[16].Value;
                }
                if (silv > 0)
                {
                    coststring += " " + silv + " " + Lang.inter[17].Value;
                }
                if (copp > 0)
                {
                    coststring += " " + copp + " " + Lang.inter[18].Value;
                }
                coststring += " to reroll your item evolution tree";
                Main.NewText(coststring);
            }
        }
        public override void Action(CommandCaller caller, string input, string[] args)
        {
            RPGPlayer character = caller.Player.GetModPlayer <RPGPlayer>();

            character.RecalculateStat();
        }