Beispiel #1
0
 public SuitEffectInfo GetSuitEffectInfo(string id)
 {
     try
     {
         if (string.IsNullOrEmpty(id))
         {
             return(null);
         }
         string ID = "'" + id + "'";
         SimpleSQL.SimpleDataTable dt = dbManager.QueryGeneric(
             "SELECT " + "*" +
             "FROM " +
             "SuitEffect " +
             "WHERE " + "SuitID LIKE " + ID
             );
         PowerUps       ups1          = new PowerUps(dt.rows[0]["PowerUps1"].ToString());
         PowerUps       ups2          = new PowerUps(dt.rows[0]["PowerUps2"].ToString());
         SuitEffectInfo setEffectInfo = new SuitEffectInfo(dt.rows[0]["SuitID"].ToString(), dt.rows[0]["SuitName"].ToString(), ups1, ups2, (int)dt.rows[0]["Suit1Num"], (int)dt.rows[0]["Suit2Num"]);
         return(setEffectInfo);
     }
     catch (System.Exception ex)
     {
         Debug.Log("\"" + id + "\"" + ex.Message);
         return(null);
     }
 }
    public WeaponItem(string id, string name, string description, string icon, int max_c, float weight, int bprice, int sprice, bool sellable, bool usable, WeaponType type, int atk, SuitEffectInfo set) :
        base(id, name, description, icon, max_c, weight, bprice, sprice, sellable, usable)
    {
        /*Debug.Log(icon);
        *  if (icon.Contains("Icon/Item/Weapon/Halberd/"))
        *  {
        *   StringBuilder sb = new StringBuilder(icon);
        *   sb.Replace("Icon/Item/Weapon/Halberd/", "");
        *   icon = sb.ToString();
        *  }
        *  else if(icon.Contains("Icon/Item/Weapon/Spear/"))
        *  {
        *   StringBuilder sb = new StringBuilder(icon);
        *   sb.Replace("Icon/Item/Weapon/Spear/", "");
        *   icon = sb.ToString();
        *  }
        *  else if(icon.Contains("Icon/Item/Weapon/Sword/"))
        *  {
        *   StringBuilder sb = new StringBuilder(icon);
        *   sb.Replace("Icon/Item/Weapon/Sword/", "");
        *   icon = sb.ToString();
        *  }
        *  else if(icon.Contains("Icon/Item/Weapon/Blade/"))
        *  {
        *   StringBuilder sb = new StringBuilder(icon);
        *   sb.Replace("Icon/Item/Weapon/Blade/", "");
        *   icon = sb.ToString();
        *  }
        *  else if(icon.Contains("Icon/Item/Weapon/Shield/"))
        *  {
        *   StringBuilder sb = new StringBuilder(icon);
        *   sb.Replace("Icon/Item/Weapon/Shield/", "");
        *   icon = sb.ToString();
        *  }
        *  Debug.Log(icon);*/
        switch (type)
        {
        case WeaponType.Halberd: type_name = "戟"; /*Icon = "Icon/Item/Weapon/Halberd/" + icon;*/ break;

        case WeaponType.Spear: type_name = "长枪"; /*Icon = "Icon/Item/Weapon/Spear/" + icon;*/ break;

        case WeaponType.Sword: type_name = "单剑"; /*Icon = "Icon/Item/Weapon/Sword/" + icon;*/ break;

        case WeaponType.Blade: type_name = "单刀"; /*Icon = "Icon/Item/Weapon/Blade/" + icon;*/ break;

        default: type_name = "匕首"; /*Icon = "Icon/Item/Weapon/Shield/" + icon;*/ break;
        }
        weaponType    = type;
        ATK           = atk;
        ItemType      = ItemType.Weapon;
        ItemTypeName  = "武器";
        IsEqu         = false;
        MaterialsList = null;
        enchant       = null;
        suitEffect    = set;
        StackAble     = false;
    }
Beispiel #3
0
        public SuitEffectInfo GetEffectInfo(uint effect_id)
        {
            SuitEffectInfo info = null;

            if (!mSuitEffectInfos.TryGetValue(effect_id, out info))
            {
                info = GetItemInfo(effect_id);
            }

            return(info);
        }
    public void Unequip(PlayerInfo playerInfo)
    {
        //Debug.Log("调用了武器卸装函数");
        if (!IsEqu)
        {
            throw new System.Exception("尚未装备该物品");
        }

        /*if (!playerInfo.equipments.IsSdEquip && type == WeaponType.Shield)
         * { Debug.Log("副武器为空"); return "副武器为空"; }
         * if (!playerInfo.equipments.IsWpEquip && type != WeaponType.Shield)
         * { Debug.Log("武器为空"); return "武器为空"; }*/
        IsEqu           = false;
        playerInfo.ATK -= ATK;
        if (weaponType == WeaponType.Knife)
        {
            playerInfo.equipments.IsSdEquip = false;
            playerInfo.equipments.shield    = null;
            //Debug.Log("卸下了副武器");
            SystemMessages.AddMessage("卸下了副武器");
        }
        else
        {
            playerInfo.equipments.IsWpEquip = false;
            playerInfo.equipments.weapon    = null;
            //Debug.Log("卸下了主武器");
            SystemMessages.AddMessage("卸下了主武器");
        }
        if (enchant != null)
        {
            enchant.Unenchant(playerInfo);
        }
        if (suitEffect != null)
        {
            SuitEffectInfo sinfo = playerInfo.equipments.suitEffect.Find(s => s.SuittID == suitEffect.SuittID);
            if (sinfo != null)
            {
                sinfo.currentNum--;
                if (sinfo.currentNum <= 0)
                {
                    playerInfo.equipments.suitEffect.Remove(sinfo);
                }
                sinfo.TryUnEffect(playerInfo);
            }
        }
        ItemInfo info = new ItemInfo(this);

        info.Quantity++;
        playerInfo.bag.itemList.Add(info);
        playerInfo.bag.Current_Size++;
    }
Beispiel #5
0
        SuitEffectInfo GetItemInfo(uint id)
        {
            string query  = string.Format("SELECT * FROM {0} WHERE {0}.{1}=\"{2}\"", mTableName, "id", id);
            var    reader = DBManager.Instance.ExecuteSqliteQueryToReader(GlobalConfig.DBFile, mTableName, query);

            if (reader == null)
            {
                mSuitEffectInfos[id] = null;
                return(null);
            }

            if (!reader.HasRows || !reader.Read())
            {
                mSuitEffectInfos[id] = null;

                reader.Close();
                reader.Dispose();
                return(null);
            }


            SuitEffectInfo info = new SuitEffectInfo();

            info.id          = id;
            info.effect_type = DBTextResource.ParseUI(GetReaderString(reader, "effect_type"));
            int effect_count = DBTextResource.ParseI(GetReaderString(reader, "effect_count"));

            info.bind_infos = new List <BindInfo>(effect_count);

            for (int i = 0; i < effect_count; ++i)
            {
                var bind_info = new BindInfo();
                bind_info.model_id     = DBTextResource.ParseUI(GetReaderString(reader, "model_id_" + (i + 1)));
                bind_info.low_model_id = DBTextResource.ParseUI(GetReaderString(reader, "low_model_id_" + (i + 1)));
                bind_info.ui_model_id  = DBTextResource.ParseUI(GetReaderString(reader, "ui_model_id_" + (i + 1)));
                if (bind_info.ui_model_id == 0)
                {
                    bind_info.ui_model_id = bind_info.model_id;
                }
                bind_info.bind_node = GetReaderString(reader, "bind_node_" + (i + 1));
                info.bind_infos.Add(bind_info);
            }

            mSuitEffectInfos[info.id] = info;

            reader.Close();
            reader.Dispose();
            return(info);
        }
    public ArmorItem(string id, string name, string description, string icon, int max_c, float weight, int bprice, int sprice, bool sellable, bool usable, ArmorType type, int def, SuitEffectInfo set) :
        base(id, name, description, icon, max_c, weight, bprice, sprice, sellable, usable)
    {
        /*if(icon.Contains("Icon/Item/Armor/Clothes/"))
         * {
         *  StringBuilder sb = new StringBuilder(icon);
         *  sb.Replace("Icon/Item/Armor/Clothes/", "");
         *  icon = sb.ToString();
         * }
         * else if(icon.Contains("Icon/Item/Armor/Helmet/"))
         * {
         *  StringBuilder sb = new StringBuilder(icon);
         *  sb.Replace("Icon/Item/Armor/Helmet/", "");
         *  icon = sb.ToString();
         * }
         * else if(icon.Contains("Icon/Item/Armor/WristBand/"))
         * {
         *  StringBuilder sb = new StringBuilder(icon);
         *  sb.Replace("Icon/Item/Armor/WristBand/", "");
         *  icon = sb.ToString();
         * }
         * else if(icon.Contains("Icon/Item/Armor/Shoes/"))
         * {
         *  StringBuilder sb = new StringBuilder(icon);
         *  sb.Replace("Icon/Item/Armor/Shoes/", "");
         *  icon = sb.ToString();
         * }*/
        switch (type)
        {
        case ArmorType.Clothes: type_name = "衣服"; /*Icon = "Icon/Item/Armor/Clothes/" + icon*/; break;

        case ArmorType.Helmet: type_name = "头饰"; /*Icon = "Icon/Item/Armor/Helmet/" + icon*/; break;

        case ArmorType.WristBand: type_name = "护腕"; /*Icon = "Icon/Item/Armor/WristBand/" + icon*/; break;

        case ArmorType.Shoes: type_name = "鞋履"; /*Icon = "Icon/Item/Armor/Shoes/" + icon*/; break;
        }
        this.armorType = type;
        DEF            = def;
        ItemType       = ItemType.Armor;
        ItemTypeName   = "防具";
        IsEqu          = false;
        enchant        = null;
        StackAble      = false;
        suitEffect     = set;
    }
Beispiel #7
0
    public JewelryItem(string id, string name, string description, string icon, int max_c, float weight, int bprice, int sprice, bool sellable, bool usable, JewelryType type, PowerUps add, SuitEffectInfo set) :
        base(id, name, description, icon, max_c, weight, bprice, sprice, sellable, usable)
    {
        /*if(icon.Contains("Icon/Item/Jewelry/Necklace/"))
         * {
         *  StringBuilder sb = new StringBuilder(icon);
         *  sb.Replace("Icon/Item/Jewelry/Necklace/", "");
         *  icon = sb.ToString();
         * }
         * else if(icon.Contains("Icon/Item/Jewelry/Belt/"))
         * {
         *  StringBuilder sb = new StringBuilder(icon);
         *  sb.Replace("Icon/Item/Jewelry/Belt/", "");
         *  icon = sb.ToString();
         * }
         * else if(icon.Contains("Icon/Item/Jewelry/Ring/"))
         * {
         *  StringBuilder sb = new StringBuilder(icon);
         *  sb.Replace("Icon/Item/Jewelry/Ring/", "");
         *  icon = sb.ToString();
         * }*/
        switch (type)
        {
        case JewelryType.Necklace: type_name = "项链"; /*Icon = "Icon/Item/Jewelry/Necklace/" + icon;*/ break;

        case JewelryType.Belt: type_name = "腰饰"; /*Icon = "Icon/Item/Jewelry/Belt/" + icon;*/ break;

        case JewelryType.Ring: type_name = "戒指"; /*Icon = "Icon/Item/Jewelry/Ring/" + icon;*/ break;
        }
        this.jewelry_Type = type;
        if (add != null)
        {
            power_Add = add.Clone();
        }
        ItemType     = ItemType.Jewelry;
        ItemTypeName = "首饰";
        IsEqu        = false;
        enchant      = null;
        StackAble    = false;
        suitEffect   = set;
    }
Beispiel #8
0
    public void Equip(PlayerInfo playerInfo)
    {
        //Debug.Log("调用了首饰装备函数");
        if (IsEqu)
        {
            throw new System.Exception("已经装备了该物品");
        }
        IsEqu = true;
        power_Add.TryPowerUp(playerInfo);
        switch (jewelry_Type)
        {
        case JewelryType.Necklace:
            if (playerInfo.equipments.IsNlEquip)
            {
                //Debug.Log("已经装备了项链,因此");
                playerInfo.equipments.necklace.Unequip(playerInfo, 0);
            }
            playerInfo.equipments.IsNlEquip = true;
            playerInfo.equipments.necklace  = this;
            //Debug.Log("装备了项链");
            break;

        case JewelryType.Belt:
            if (playerInfo.equipments.IsBtEquip)
            {
                //Debug.Log("已经装备了腰饰,因此");
                playerInfo.equipments.belt.Unequip(playerInfo, 0);
            }
            playerInfo.equipments.IsBtEquip = true;
            playerInfo.equipments.belt      = this;
            //Debug.Log("装备了腰饰");
            break;

        case JewelryType.Ring:
            if (playerInfo.equipments.IsRgEquip_1 && !playerInfo.equipments.IsRgEquip_2)
            {
                playerInfo.equipments.IsRgEquip_2 = true;
                playerInfo.equipments.ring_2      = this;
            }
            else
            {
                if (playerInfo.equipments.IsRgEquip_1 && playerInfo.equipments.IsRgEquip_2)
                {
                    //Debug.Log("两手都装备了戒指,因此");
                    playerInfo.equipments.ring_1.Unequip(playerInfo, 1);
                }
                playerInfo.equipments.IsRgEquip_1 = true;
                playerInfo.equipments.ring_1      = this;
            }
            //Debug.Log("装备了戒指");
            break;
        }
        if (enchant != null)
        {
            enchant.Enchanting(playerInfo);
        }
        if (suitEffect != null)
        {
            if (playerInfo.equipments.suitEffect != null)
            {
                SuitEffectInfo sinfo = playerInfo.equipments.suitEffect.Find(s => s.SuittID == suitEffect.SuittID);
                if (sinfo != null)
                {
                    sinfo.currentNum++;
                    sinfo.TryEffect(playerInfo);
                }
                else
                {
                    suitEffect.currentNum++;
                    playerInfo.equipments.suitEffect.Add(suitEffect);
                }
            }
            else
            {
                suitEffect.currentNum++;
                playerInfo.equipments.suitEffect = new List <SuitEffectInfo>
                {
                    suitEffect
                };
            }
        }
        ItemInfo info = playerInfo.bag.itemList.Find(i => i.Item == this);

        info.Quantity--;
        playerInfo.bag.itemList.Remove(info);
        playerInfo.bag.Current_Size--;
    }
Beispiel #9
0
    public void Unequip(PlayerInfo playerInfo, int ring1or2)
    {
        //Debug.Log("调用了首饰卸装函数");
        if (!IsEqu)
        {
            throw new System.Exception("尚未装备该物品");
        }
        IsEqu = false;
        power_Add.TryPowerDown(playerInfo);
        switch (jewelry_Type)
        {
        case JewelryType.Necklace:
            playerInfo.equipments.IsNlEquip = false;
            playerInfo.equipments.necklace  = null;
            //Debug.Log("卸下了项链");
            break;

        case JewelryType.Belt:
            playerInfo.equipments.IsBtEquip = false;
            playerInfo.equipments.belt      = null;
            //Debug.Log("卸下了腰饰");
            break;

        case JewelryType.Ring:
            if (ring1or2 == 1)
            {
                playerInfo.equipments.IsRgEquip_1 = false;
                playerInfo.equipments.ring_1      = null;
                //Debug.Log("卸下了戒指1");
            }
            else if (ring1or2 == 2)
            {
                playerInfo.equipments.IsRgEquip_2 = false;
                playerInfo.equipments.ring_2      = null;
                //Debug.Log("卸下了戒指2");
            }
            break;
        }
        if (enchant != null)
        {
            enchant.Unenchant(playerInfo);
        }
        if (suitEffect != null)
        {
            SuitEffectInfo sinfo = playerInfo.equipments.suitEffect.Find(s => s.SuittID == suitEffect.SuittID);
            if (sinfo != null)
            {
                sinfo.currentNum--;
                if (sinfo.currentNum <= 0)
                {
                    playerInfo.equipments.suitEffect.Remove(sinfo);
                }
                sinfo.TryUnEffect(playerInfo);
            }
        }
        ItemInfo info = new ItemInfo(this);

        info.Quantity++;
        playerInfo.bag.itemList.Add(info);
        playerInfo.bag.Current_Size++;
    }
    public void Equip(PlayerInfo playerInfo)
    {
        //Debug.Log("调用了防具装备函数");
        if (IsEqu)
        {
            throw new System.Exception("已经装备了该物品");
        }
        IsEqu           = true;
        playerInfo.DEF += DEF;
        switch (armorType)
        {
        case ArmorType.Clothes:
            if (playerInfo.equipments.IsClEquip)
            {
                //Debug.Log("已经装备了衣服,因此");
                playerInfo.equipments.clothes.Unequip(playerInfo);
            }
            playerInfo.equipments.IsClEquip = true;
            playerInfo.equipments.clothes   = this;
            //Debug.Log("装备了衣服");
            SystemMessages.AddMessage("装备了衣服");
            break;

        case ArmorType.Helmet:
            if (playerInfo.equipments.IsHmEquip)
            {
                //Debug.Log("已经装备了头饰,因此");
                playerInfo.equipments.helmet.Unequip(playerInfo);
            }
            playerInfo.equipments.IsHmEquip = true;
            playerInfo.equipments.helmet    = this;
            //Debug.Log("装备了头饰");
            SystemMessages.AddMessage("装备了头饰");
            break;

        case ArmorType.WristBand:
            if (playerInfo.equipments.IsWBEquip)
            {
                //Debug.Log("已经装备了护腕,因此");
                playerInfo.equipments.wristband.Unequip(playerInfo);
            }
            playerInfo.equipments.IsWBEquip = true;
            playerInfo.equipments.wristband = this;
            //Debug.Log("装备了护腕");
            SystemMessages.AddMessage("装备了护腕");
            break;

        case ArmorType.Shoes:
            if (playerInfo.equipments.IsShEquip)
            {
                //Debug.Log("已经装备了鞋履,因此");
                playerInfo.equipments.shoes.Unequip(playerInfo);
            }
            playerInfo.equipments.IsShEquip = true;
            playerInfo.equipments.shoes     = this;
            //Debug.Log("装备了鞋履");
            SystemMessages.AddMessage("装备了鞋履");
            break;
        }
        if (enchant != null)
        {
            enchant.Enchanting(playerInfo);
        }
        if (suitEffect != null)
        {
            if (playerInfo.equipments.suitEffect != null)
            {
                SuitEffectInfo sinfo = playerInfo.equipments.suitEffect.Find(s => s.SuittID == suitEffect.SuittID);
                if (sinfo != null)
                {
                    sinfo.currentNum++;
                    sinfo.TryEffect(playerInfo);
                }
                else
                {
                    suitEffect.currentNum++;
                    playerInfo.equipments.suitEffect.Add(suitEffect);
                }
            }
            else
            {
                suitEffect.currentNum++;
                playerInfo.equipments.suitEffect = new List <SuitEffectInfo>
                {
                    suitEffect
                };
            }
        }
        ItemInfo info = playerInfo.bag.itemList.Find(i => i.Item == this);

        info.Quantity--;
        playerInfo.bag.itemList.Remove(info);
        playerInfo.bag.Current_Size--;
    }
    public void Unequip(PlayerInfo playerInfo)
    {
        //Debug.Log("调用了防具卸装函数");
        if (!IsEqu)
        {
            throw new System.Exception("尚未装备该物品");
        }
        IsEqu           = false;
        playerInfo.DEF -= DEF;
        switch (armorType)
        {
        case ArmorType.Clothes:
            playerInfo.equipments.IsClEquip = false;
            playerInfo.equipments.clothes   = null;
            //Debug.Log("卸下了衣服");
            SystemMessages.AddMessage("卸下了衣服");
            break;

        case ArmorType.Helmet:
            playerInfo.equipments.IsHmEquip = false;
            playerInfo.equipments.helmet    = null;
            //Debug.Log("卸下了头饰");
            SystemMessages.AddMessage("卸下了头饰");
            break;

        case ArmorType.WristBand:
            playerInfo.equipments.IsWBEquip = false;
            playerInfo.equipments.wristband = null;
            //Debug.Log("卸下了护腕");
            SystemMessages.AddMessage("卸下了护腕");
            break;

        case ArmorType.Shoes:
            playerInfo.equipments.IsShEquip = false;
            playerInfo.equipments.shoes     = null;
            //Debug.Log("卸下了鞋履");
            SystemMessages.AddMessage("卸下了鞋履");
            break;
        }
        if (enchant != null)
        {
            enchant.Unenchant(playerInfo);
        }
        if (suitEffect != null)
        {
            SuitEffectInfo sinfo = playerInfo.equipments.suitEffect.Find(s => s.SuittID == suitEffect.SuittID);
            if (sinfo != null)
            {
                sinfo.currentNum--;
                if (sinfo.currentNum <= 0)
                {
                    playerInfo.equipments.suitEffect.Remove(sinfo);
                }
                sinfo.TryUnEffect(playerInfo);
            }
        }
        ItemInfo info = new ItemInfo(this);

        info.Quantity++;
        playerInfo.bag.itemList.Add(info);
        playerInfo.bag.Current_Size++;
    }
    public void Equip(PlayerInfo playerInfo)
    {
        //Debug.Log("调用了武器装备函数");
        if (IsEqu)
        {
            throw new System.Exception("已经装备了该物品");
        }
        if (!CheckEquipAble(playerInfo))
        {
            throw new System.Exception("武器不符,无法装备");
        }
        IsEqu           = true;
        playerInfo.ATK += ATK;
        if (this.weaponType == WeaponType.Knife)
        {
            if (playerInfo.equipments.IsSdEquip)
            {
                //Debug.Log("已经装备了副武器,因此");
                playerInfo.equipments.shield.Unequip(playerInfo);
            }
            playerInfo.equipments.IsSdEquip = true;
            playerInfo.equipments.shield    = this;
            //Debug.Log("装备了副武器");
            SystemMessages.AddMessage("装备了副武器");
        }
        else
        {
            if (playerInfo.equipments.IsWpEquip)
            {
                //Debug.Log("已经装备了主武器,因此");
                playerInfo.equipments.weapon.Unequip(playerInfo);
            }
            playerInfo.equipments.IsWpEquip = true;
            playerInfo.equipments.weapon    = this;
            //Debug.Log("装备了主武器");
            SystemMessages.AddMessage("装备了主武器");
        }
        if (enchant != null)
        {
            enchant.Enchanting(playerInfo);
        }
        if (suitEffect != null)
        {
            if (playerInfo.equipments.suitEffect != null)
            {
                SuitEffectInfo sinfo = playerInfo.equipments.suitEffect.Find(s => s.SuittID == suitEffect.SuittID);
                if (sinfo != null)
                {
                    sinfo.currentNum++;
                    sinfo.TryEffect(playerInfo);
                }
                else
                {
                    suitEffect.currentNum++;
                    playerInfo.equipments.suitEffect.Add(suitEffect);
                }
            }
            else
            {
                suitEffect.currentNum++;
                playerInfo.equipments.suitEffect = new List <SuitEffectInfo>
                {
                    suitEffect
                };
            }
        }
        ItemInfo info = playerInfo.bag.itemList.Find(i => i.Item == this);

        info.Quantity--;
        playerInfo.bag.itemList.Remove(info);
        playerInfo.bag.Current_Size--;
    }