static public bool ModifyFaction(Player Plr, ref List <string> Values) { byte Faction = (byte)GetInt(ref Values); byte Save = (byte)(Values.Count > 0 ? GetInt(ref Values) : 0); Object Obj = GetObjectTarget(Plr); RegionMgr Region = Obj.Region; ushort ZoneId = Obj.Zone.ZoneId; Obj.RemoveFromWorld(); Obj.GetUnit().SetFaction(Faction); Region.AddObject(Obj.GetUnit(), ZoneId, true); if (Save > 0) { if (Obj.IsCreature()) { Creature Crea = Obj.GetCreature(); Crea.Spawn.Faction = Faction; WorldMgr.Database.SaveObject(Crea.Spawn); } } return(true); }
public void AddPlayer(Player player) { lock (_Players) { if (!_Players.Contains(player.Name)) { _Players.Add(player.Name); } } player.InstanceID = ID; // player._Value.AddLogout("60;"+(TCPManager.GetTimeStamp()+34000)+";1;4"); // player.SendLockouts(); Region.AddObject(player, ZoneID, true); }
static public void F_INIT_PLAYER(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; Log.Success("F_INIT_PLAYER", "Lancement !"); Player Plr = cclient.Plr; if (!Plr.IsInWorld()) // Si le joueur n'est pas sur une map, alors on l'ajoute a la map { UInt16 ZoneId = Plr._Info.Value[0].ZoneId; ushort RegionId = (ushort)Plr._Info.Value[0].RegionId; RegionMgr Region = WorldMgr.GetRegion(RegionId, true); Region.AddObject(Plr, ZoneId); } else Plr._Loaded = false; }
public Instance(ushort zoneid, ushort id, byte realm, Instance_Lockouts lockouts) { Lockout = lockouts; ID = id; ZoneID = zoneid; Realm = realm; Region = new RegionMgr(zoneid, ZoneService.GetZoneRegion(zoneid)); InstanceService._InstanceInfo.TryGetValue(zoneid, out Info); LoadBossSpawns(); LoadSpawns(); // todo get the saved progress from group _running = true; _evtInterface = new EventInterface(); closetime = (TCPManager.GetTimeStamp() + 7200); new Thread(Update).Start(); Log.Success("Opening Instance", "Instance ID " + ID + " Map: " + Info.Name); if (zoneid == 179) { foreach (var p in GameObjectService.GameObjectSpawns.Where(e => e.Value.ZoneId == 179)) { if (p.Value.Entry == 98908) { GameObject go = new GameObject(p.Value); _Objects.Add(go); Region.AddObject(go, zoneid, true); } } if (_Objects.Count > 0) { LoadObjects(); } _evtInterface.AddEvent(UpdatePendulums, 7000, 0); } }
static public void F_INIT_PLAYER(BaseClient client, PacketIn packet) { GameClient cclient = client as GameClient; Player Plr = cclient.Plr; if (Plr == null) { return; } if (!Plr.IsInWorld()) // Si le joueur n'est pas sur une map, alors on l'ajoute a la map { UInt16 ZoneId = Plr._Info.Value.ZoneId; ushort RegionId = (ushort)Plr._Info.Value.RegionId; RegionMgr Region = WorldMgr.GetRegion(RegionId, true); Region.AddObject(Plr, ZoneId, false); } else { Plr._Loaded = false; } }
public static void Create(RegionMgr region, PQuest_Info info, ref Dictionary <uint, ContributionInfo> players, float bagCountMod) { if (region == null) { Log.Error("GoldChest", "Attempt to create for NULL region"); return; } if (info == null) { Log.Error("GoldChest", "NULL PQuest in Region " + region); return; } if (bagCountMod == 0.0f) { return; } GameObject_proto proto = GameObjectService.GetGameObjectProto(188); GameObject_spawn spawn = new GameObject_spawn { Guid = (uint)GameObjectService.GenerateGameObjectSpawnGUID(), WorldO = 0, WorldY = info.GoldChestWorldY, WorldZ = info.GoldChestWorldZ, WorldX = info.GoldChestWorldX, ZoneId = info.ZoneId }; spawn.BuildFromProto(proto); GoldChest chest = new GoldChest(spawn, info, ref players, bagCountMod, region); region.AddObject(chest, info.ZoneId); }
public static void F_INIT_PLAYER(BaseClient client, PacketIn packet) { GameClient cclient = (GameClient)client; Player Plr = cclient.Plr; if (Plr == null) { return; } if (!Plr.IsInWorld()) // If the player is not on a map, then we add it to the map { ushort zoneId = Plr.Info.Value.ZoneId; ushort regionId = (ushort)Plr.Info.Value.RegionId; Zone_Info info = ZoneService.GetZone_Info(zoneId); if (info?.Type == 0) { RegionMgr region = WorldMgr.GetRegion(regionId, true); if (region.AddObject(Plr, zoneId, true)) { return; } } else if (info?.Type == 4 || info?.Type == 5 || info?.Type == 6) // login into a instance { if (!WorldMgr.InstanceMgr.ZoneIn(Plr, (byte)info?.Type)) // cant login into the instace port to exit { Instance_Info II; InstanceService._InstanceInfo.TryGetValue(zoneId, out II); Zone_jump ExitJump = ZoneService.GetZoneJump(II.exitzonejup); if (ExitJump == null) { Log.Error("Exit Jump in Instance", " " + zoneId + " missing!"); } else { if (ExitJump.Type == 4) { WorldMgr.InstanceMgr.ZoneIn(Plr, 4, ExitJump); } else { Plr.Teleport(ExitJump.ZoneID, ExitJump.WorldX, ExitJump.WorldY, ExitJump.WorldZ, ExitJump.WorldO); } } } return; } // Warp a player to their bind point if they attempt to load into a scenario map. RallyPoint rallyPoint = RallyPointService.GetRallyPoint(Plr.Info.Value.RallyPoint); if (rallyPoint != null) { Plr.Teleport(rallyPoint.ZoneID, rallyPoint.WorldX, rallyPoint.WorldY, rallyPoint.WorldZ, rallyPoint.WorldO); } else { CharacterInfo cInfo = CharMgr.GetCharacterInfo(Plr.Info.Career); Plr.Teleport(cInfo.ZoneId, (uint)cInfo.WorldX, (uint)cInfo.WorldY, (ushort)cInfo.WorldZ, (ushort)cInfo.WorldO); } } else { Plr.Loaded = false; Plr.StartInit(); } }