public static MonsterTemplate ReadFromDB(object[] row) { // 0: template_id int(11) unsigned // 1: game_id int(10) unsigned // 2: hp int(10) unsigned // 3: idle_move_chance double // 4: idle_move_speed tinyint(3) unsigned // 5: critical_chance double // 6: attack_delay double // 7: attack_min smallint(5) unsigned // 8: attack_max smallint(5) unsigned // 9: exp_min int(11) // 10: exp_max int(11) // 11: gold_min int(11) // 12: gold_max int(11) // 13: loot_table int(11) MonsterTemplate mt = new MonsterTemplate(); mt._id = (uint)row[0]; mt._gameID = (uint)row[1]; mt._hp = (uint)row[2]; mt._idleMoveChance = (double)row[3]; mt._idleMoveSpeed = (byte)row[4]; mt._criticalChance = (double)row[5]; mt._attackDelay = (double)row[6]; mt._attackMin = (ushort)row[7]; mt._attackMax = (ushort)row[8]; mt._expMin = (int)row[9]; mt._expMax = (int)row[10]; mt._goldMin = (int)row[11]; mt._goldMax = (int)row[12]; int lootTable = (int)row[13]; mt._lootTable = Program.Server.GetLootTable(lootTable); return(mt); }
public Monster(Location loc, MonsterTemplate template) : base() { s_monsterID++; if( s_monsterID < 0xFFFF ) s_monsterID = 0xFFFF + 1; _enemies = new Dictionary<int, uint>(); _enemyLock = new Mutex(); _loc = loc; _template = template; _id = s_monsterID; _gameID = (ushort)_template.GameID; _cellIndex = _moveTargetCell = loc.RandomCell; _mapID = loc.Map; _hp = _curhp = _template.HP; _aiState = AIState.Idle; _aiTimer = 0; _moveTimer = 0; }
public Monster(Location loc, MonsterTemplate template) : base() { s_monsterID++; if (s_monsterID < 0xFFFF) { s_monsterID = 0xFFFF + 1; } _enemies = new Dictionary <int, uint>(); _enemyLock = new Mutex(); _loc = loc; _template = template; _id = s_monsterID; _gameID = (ushort)_template.GameID; _cellIndex = _moveTargetCell = loc.RandomCell; _mapID = loc.Map; _hp = _curhp = _template.HP; _aiState = AIState.Idle; _aiTimer = 0; _moveTimer = 0; }
public void AddMonsterTemplate(MonsterTemplate mt) { _monsterTemplates[mt.ID] = mt; }
public static MonsterTemplate ReadFromDB(object[] row) { // 0: template_id int(11) unsigned // 1: game_id int(10) unsigned // 2: hp int(10) unsigned // 3: idle_move_chance double // 4: idle_move_speed tinyint(3) unsigned // 5: critical_chance double // 6: attack_delay double // 7: attack_min smallint(5) unsigned // 8: attack_max smallint(5) unsigned // 9: exp_min int(11) // 10: exp_max int(11) // 11: gold_min int(11) // 12: gold_max int(11) // 13: loot_table int(11) MonsterTemplate mt = new MonsterTemplate(); mt._id = (uint)row[0]; mt._gameID = (uint)row[1]; mt._hp = (uint)row[2]; mt._idleMoveChance = (double)row[3]; mt._idleMoveSpeed = (byte)row[4]; mt._criticalChance = (double)row[5]; mt._attackDelay = (double)row[6]; mt._attackMin = (ushort)row[7]; mt._attackMax = (ushort)row[8]; mt._expMin = (int)row[9]; mt._expMax = (int)row[10]; mt._goldMin = (int)row[11]; mt._goldMax = (int)row[12]; int lootTable = (int)row[13]; mt._lootTable = Program.Server.GetLootTable(lootTable); return mt; }