Files
test/Assets/PerfectWorld/Scripts/Managers/EC_ProfConfigs.cs
T

153 lines
5.3 KiB
C#

using BrewMonster.Scripts;
using BrewMonster;
public static class EC_ProfConfigs
{
public static bool IsProfession(int prof)
{
return prof >= 0 && prof < (int)Profession.NUM_PROFESSION;
}
public static bool IsGender(int gender)
{
return gender >= 0 && gender < (int)Gender.NUM_GENDER;
}
public static bool IsRace(int race)
{
return race >= 0 && race < (int)Race.NUM_RACE;
}
public static bool IsExist(int prof, int gender)
{
if (IsProfession(prof) && IsGender(gender)){
bool[,] s_bExist = {
{ true, true}, // 0:
{ true, true}, // 1:ʦ
{ true, true}, // 2:ʦ
{ false, true}, // 3:
{ true, false}, // 4:
{ true, true}, // 5:̿
{ true, true}, // 6:â
{ true, true}, // 7:
{ true, true}, // 8:
{ true, true}, // 9:
{ true, true}, // 10:ҹӰ
{ true, true}, // 11:
};
return s_bExist[prof, gender];
}else{
//BMLogger.LogError("EC_ProfConfigs: IsExist: prof: {0} gender: {1} is not exist", prof, gender);
return false;
}
}
public static int GetCounterpartGender(int gender)
{
return gender == (int)Gender.GENDER_MALE ? (int)Gender.GENDER_FEMALE : (int)Gender.GENDER_MALE;
}
public static bool CanShowOnCreate(int prof, int gender)
{
// ɫʱǷӦʾְҵģͣÿְҵʾһԱ
if (IsProfession(prof) && IsGender(gender)){
bool[] s_bShowMale = {
true, // 0:
false, // 1:ʦ
false, // 2:ʦ
false, // 3:
true, // 4:
true, // 5:̿
true, // 6:â
false, // 7:
true, // 8:
false, // 9:
true, // 8:ҹӰ
false, // 9:
};
return (gender == (int)Gender.GENDER_MALE) ? s_bShowMale[prof] : !s_bShowMale[prof];
}
//BMLogger.LogError("EC_ProfConfigs: CanShowOnCreate: prof: {0} gender: {1} is not exist", prof, gender);
return false;
}
public static int GetRaceShowOrder(int race)
{
// ֵԽСȼԽ
if (IsRace(race)){
int[] s_nRaceOrder = {
1,
2,
3,
4,
5,
0,
};
return s_nRaceOrder[race];
}
//BMLogger.LogError("EC_ProfConfigs: GetRaceShowOrder: race: {0} is not exist", race);
return -1;
}
public static int GetRaceByProfession(int prof)
{
if (IsProfession(prof)){
int[] s_nProfRace = {
(int)Race.RACE_HUMAN,
(int)Race.RACE_HUMAN,
(int)Race.RACE_GHOST,
(int)Race.RACE_ORC,
(int)Race.RACE_ORC,
(int)Race.RACE_GHOST,
(int)Race.RACE_ELF,
(int)Race.RACE_ELF,
(int)Race.RACE_LING,
(int)Race.RACE_LING,
(int)Race.RACE_OBORO,
(int)Race.RACE_OBORO,
};
return s_nProfRace[prof];
}
//BMLogger.LogError("EC_ProfConfigs: GetRaceByProfession: prof: {0} is not exist", prof);
return -1;
}
public static int GetProfessionShowOrderInRace(int prof)
{
// ֵԽСȼԽ
if (IsProfession(prof)){
int[] s_nRaceZeroShowOrderProf = {
(int)Profession.PROF_WARRIOR, //
(int)Profession.PROF_ORC, //
(int)Profession.PROF_ANGEL, // ˣ
(int)Profession.PROF_MONK, // ϫʦ
(int)Profession.PROF_JIANLING, //
(int)Profession.PROF_YEYING, // 壺ҹӰ
};
int race = GetRaceByProfession(prof);
return prof == s_nRaceZeroShowOrderProf[race] ? 0 : 1;
}
//BMLogger.LogError("EC_ProfConfigs: GetProfessionShowOrderInRace: prof: {0} is not exist", prof);
return -1;
}
public static bool ContainsAllProfession(uint mask){
return (GetAllProfessionMask() & mask) == GetAllProfessionMask();
}
public static uint GetAllProfessionMask(){
const uint ALL_PROFESSION_MASK = (1 << (int)Profession.NUM_PROFESSION)-1;
return ALL_PROFESSION_MASK;
}
public static int GetMaxBodyID(int prof)
{
if (IsProfession(prof)){
// PROF_ANGEL, PROF_ARCHOR, PROF_MAGE, PROF_WARRIOR didn't have nBodyID
int[] s_maxBodyID = {-1, -1, 4, 5, 3, 4, -1, -1, 4, 4, 1, 1 };
return s_maxBodyID[prof];
}
//BMLogger.LogError("EC_ProfConfigs: GetMaxBodyID: prof: {0} is not exist", prof);
return -1;
}
}