public static void LoadGuildID(ZoneCharacter pChar) { Guild g; using(Database.DatabaseClient dbclient = Program.CharDBManager.GetClient()) { int AcademyID = dbclient.ReadInt32("SELECT GuildID FROM guildacademymembers WHERE CharID=" + pChar.ID + ""); int GuildID = dbclient.ReadInt32("SELECT GuildID FROM guildmembers WHERE CharID=" + pChar.ID + ""); if(GuildID > 0) { if (!GuildManager.GetGuildByID(GuildID, out g)) return; pChar.Guild = g; pChar.GuildMember = g.Members.Find(m => m.CharacterID== pChar.Character.ID); pChar.Character.GuildID = g.ID; } else if(AcademyID > 0) { if (!GuildManager.GetGuildByID(AcademyID, out g)) return; pChar.GuildAcademy = g.Academy; pChar.GuildAcademyMember = g.Academy.Members.Find(m => m.Character.ID == pChar.Character.ID); pChar.Character.AcademyID = g.ID; pChar.IsInaAcademy = true; } } }
public void Transfer(MapObject obj, Sector to) { Objects.Remove(obj.MapObjectID); to.AddObject(obj); // we remove object first to the 'non display region' ZoneCharacter character = obj as ZoneCharacter; List <Sector> oldsectors = Map.GetSectorsOutOfRange(this, to); // The idea of this function // 1. Remove obj from map for players that are out of range // (IF PLAYER) 2. Remove objects that are out of range for obj // (IF PLAYER) 3. Spawn objects that are new in range for obj // 4. Spawn obj for all players in new range using (var removeObjPacket = Handler7.RemoveObject(obj)) // Make new packet to remove object from map for others { // Even nederlands: Kijken of we mensen kunnen vinden in range? foreach (var victimObject in Map.GetObjectsBySectors(oldsectors)) { if (victimObject is Npc) { continue; // NPC's are for noobs. Can't despawn } if (victimObject is ZoneCharacter) { // Remove obj for player ZoneCharacter victim = victimObject as ZoneCharacter; victim.Client.SendPacket(removeObjPacket); } if (character != null) { // Despawn victimObject for obj using (var removeVictimPacket = Handler7.RemoveObject(victimObject)) { character.Client.SendPacket(removeVictimPacket); } } } } //we remove all the drops out of the character's region if (character != null && character.Client != null) { foreach (var dropoutofrange in Map.GetDropsBySectors(oldsectors)) { using (var despawndrop = Handler6.RemoveDrop(dropoutofrange)) { character.Client.SendPacket(despawndrop); } } } //now we spawn the object to other objects in map List <Sector> newsectors = Map.GetSectorsNewInRange(this, to); List <MapObject> objects = Map.GetObjectsBySectors(newsectors); using (var packet = obj.Spawn()) { foreach (var mapObject in objects) { if (mapObject is Npc) { continue; //we don't respawn NPCs } if (mapObject is ZoneCharacter) { ZoneCharacter rangechar = mapObject as ZoneCharacter; // Send spawn packet of the object (can be both a character and mob) to mapObject (a player) rangechar.Client.SendPacket(packet); } if (character != null) { // Send spawn packet of mapObject to character using (var spawn = mapObject.Spawn()) { character.Client.SendPacket(spawn); } } } } if (character != null && character.Client != null) { using (var spawndrops = Handler7.ShowDrops(Map.GetDropsBySectors(newsectors))) { character.Client.SendPacket(spawndrops); } } }
private void AdminLevel(ZoneCharacter character, params string[] param) { Log.WriteLine(LogLevel.Debug, "GM {0} authenticated ingame.", character.Name); character.DropMessage("Admin level is {0}", character.Client.Admin); InterHandler.SendWorldMessage(FiestaLib.WorldMessageTypes.Level20, "Fun!"); }
public Buffs(ZoneCharacter pChar) { Character = pChar; CurrentBuffs = new List <Buff>(); }
private static void On_CharacterManager_CharacterLogin(ZoneCharacter Character) { SetGuildBuff(Character); }
public static void RemoveGuildBuff(ZoneCharacter Character) { /* Buff buff; if (Character.Buffs.GetBuff(b => b.AbStateInfo.ID.Equals(GuildDataProvider.AcademyBuff.ID), out buff)) { Character.Buffs.Remove(buff); }*/ }
private void GiveMoney(ZoneCharacter character, params string[] param) { var giveDm = long.Parse(param[1]); character.ChangeMoney(character.Inventory.Money += giveDm); }
private static void On_CharacterManager_CharacterLogin(ZoneCharacter Character) { SetGuildBuff(Character); }
private void Performance(ZoneCharacter character, params string[] param) { character.DropMessage("Ticks per second on this zone: {0}", Worker.Instance.TicksPerSecond); }
public void CanWald(ZoneCharacter @char, params string[] param) { }
private void ChangeMoney(ZoneCharacter character, params string[] param) { long newMoney = long.Parse(param[1].ToString()); character.ChangeMoney(newMoney); }
private void GiveMoney(ZoneCharacter character, params string[] param) { long givedm = long.Parse(param[1].ToString()); character.ChangeMoney(character.Inventory.Money += givedm); }
public static void InvokeCharacterLogin(ZoneCharacter pChar) { OnCharacterLogin.Invoke(pChar); }
private static void HandleMovement(ZoneCharacter character, Packet packet, bool run, bool stop = false) { if (character.State == PlayerState.Dead || character.State == PlayerState.Resting || character.State == PlayerState.Vendor) { character.CheatTracker.AddCheat(CheatTypes.InvalidMove, 50); return; } int newX, oldX, newY, oldY; if (!stop) { if (!packet.TryReadInt(out oldX) || !packet.TryReadInt(out oldY) || !packet.TryReadInt(out newX) || !packet.TryReadInt(out newY)) { Log.WriteLine(LogLevel.Warn, "Invalid movement packet detected."); return; } } else { if (!packet.TryReadInt(out newX) || !packet.TryReadInt(out newY)) { Log.WriteLine(LogLevel.Warn, "Invalid stop packet detected."); return; } oldX = character.Position.X; oldY = character.Position.Y; } if (character.Map.Block != null) { if (!character.Map.Block.CanWalk(newX, newY)) { Log.WriteLine(LogLevel.Debug, "Blocking walk at {0}:{1}.", newX, newY); SendPositionBlock(character, newX, newY); SendTeleportCharacter(character, oldX, oldY); return; } } var distance = Vector2.Distance(newX, oldX, newY, oldY); if (run && distance > 500d || !run && distance > 400d) //TODO: mounts don't check with these speeds { character.CheatTracker.AddCheat(CheatTypes.Speedwalk, 50); return; } if (!stop) { var deltaY = newY - character.Position.Y; var deltaX = newX - character.Position.X; var radians = Math.Atan((double)deltaY / deltaX); var angle = radians * (180 / Math.PI); character.Rotation = (byte)(angle / 2); } foreach (var member in character.Party) { if (member.Key != character.Name) { using (var ppacket = new Packet(SH14Type.UpdatePartyMemberLoc)) { ppacket.WriteByte(1); //unk ppacket.WriteString(character.Name, 16); ppacket.WriteInt(character.Position.X); ppacket.WriteInt(character.Position.Y); member.Value.SendPacket(ppacket); } } } character.Move(oldX, oldY, newX, newY, !run, stop); // hehe }
public CheatTracker(ZoneCharacter character) { this.character = character; }
public static void ModifyInventorySlot(ZoneCharacter character, byte inventory, byte oldslot, byte newslot, Item item) { ModifyInventorySlot(character, inventory, 0x24, oldslot, newslot, item); }
public void LoadFull(ZoneCharacter pChar) { try { locker.WaitOne(); DataTable items = null; using (var dbClient = Program.CharDBManager.GetClient()) { items = dbClient.ReadDataTable("SELECT * FROM items WHERE Owner=" + pChar.ID + ""); } //we load all equippeditem if (items != null) { foreach (DataRow row in items.Rows) { var loaded = Item.LoadItem(row); loaded.Owner = (uint)pChar.ID; loaded.UpgradeStats = new UpgradeStats(); if (loaded.IsEquipped) { loaded.Slot = (sbyte)loaded.ItemInfo.Slot; EquippedItems.Add(loaded); } else { InventoryItems.Add((byte)loaded.Slot, loaded); } } } //we load inventory slots if (items != null) { foreach (DataRow row in items.Rows) { var loaded = Item.LoadItem(row); /* if (loaded.ItemInfo.Class == ItemClass.Rider) * { * Mount mount = Data.DataProvider.Instance.GetMountByItemID(loaded.ID); * if (mount != null) * { * loaded.Mount = mount; * loaded.Mount.Food = GetDataTypes.GetUshort(row["fuelcount"]); * loaded.Mount.ItemSlot = (byte)loaded.Slot; * } * this.AddToInventory(loaded); * } * else * {*/ AddToInventory(loaded); //} } } } finally { locker.ReleaseMutex(); } }
private void ExpGet(ZoneCharacter character, params string[] param) { uint exp = param.Length >= 2 ? uint.Parse(param[1]) : 1234567; character.GiveExp(exp); }
public Buffs(ZoneCharacter pChar) { Character = pChar; CurrentBuffs = new List<Buff>(); }
private void DamageMe(ZoneCharacter character, params string[] param) { uint value = uint.Parse(param[1]); character.Damage(value); }
private void ChangeMoney(ZoneCharacter character, params string[] param) { var newMoney = long.Parse(param[1]); character.ChangeMoney(newMoney); }
private void Heal(ZoneCharacter character, params string[] param) { character.Heal(); }
public static void SetGuildBuff(ZoneCharacter Character) { //Later //check if character needs guild buff /* if (Character.IsInGuild || Character.IsInGuildAcademy) { var remainingBuffTime = (Character.GuildAcademy.GuildBuffKeepTime - (ZoneService.Instance.Time - Character.GuildAcademy.GuildBuffUpdateTime)).TotalMilliseconds; if (remainingBuffTime > 0) { Character.Buffs.Add(GuildDataProvider.AcademyBuff, GuildDataProvider.AcademyBuffStrength, (uint)remainingBuffTime); } }*/ }
private void ResetInv(ZoneCharacter character, params string[] param) { byte slot = byte.Parse(param[1]); Handler12.ResetInventorySlot(character, slot); }
private void Clone(ZoneCharacter character, params string[] param) { }
private static void HandleMovement(ZoneCharacter character, Packet packet, bool run, bool stop = false) { if (character.State == PlayerState.Dead || character.State == PlayerState.Resting || character.State == PlayerState.Vendor) { character.CheatTracker.AddCheat(CheatTypes.INVALID_MOVE, 50); return; } int newX, oldX, newY, oldY; if (!stop) { if (!packet.TryReadInt(out oldX) || !packet.TryReadInt(out oldY) || !packet.TryReadInt(out newX) || !packet.TryReadInt(out newY)) { Log.WriteLine(LogLevel.Warn, "Invalid movement packet detected."); return; } } else { if (!packet.TryReadInt(out newX) || !packet.TryReadInt(out newY)) { Log.WriteLine(LogLevel.Warn, "Invalid stop packet detected."); return; } oldX = character.Position.X; oldY = character.Position.Y; } if (character.Map.Block != null) { if (Settings.Instance.UseSHBD) { if (!character.Map.Block.CanWalk(newX, newY)) { Log.WriteLine(LogLevel.Debug, "Blocking walk at {0}:{1}.", newX, newY); SendPositionBlock(character, newX, newY); SendTeleportCharacter(character, oldX, oldY); return; } } } double distance = Vector2.Distance(newX, oldX, newY, oldY); if ((run && distance > 500d) || (!run && distance > 400d)) //TODO: mounts don't check with these speeds { character.CheatTracker.AddCheat(Security.CheatTypes.SPEEDWALK, 50); return; } if (!stop) { int deltaY = newY - character.Position.Y; int deltaX = newX - character.Position.X; double radians = Math.Atan((double)deltaY / deltaX); double angle = radians * (180 / Math.PI); character.Rotation = (byte)(angle / 2); } character.Move(oldX, oldY, newX, newY, !run, stop); // hehe }