示例#1
0
        public override void SendWarmapUpdate(ICollection <IGameKeep> list)
        {
            if (m_gameClient.Player == null)
            {
                return;
            }

            using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.WarMapClaimedKeeps)))
            {
                int KeepCount  = 0;
                int TowerCount = 0;
                foreach (AbstractGameKeep keep in list)
                {
                    // New Agramon tower are counted as keep
                    if (keep is GameKeep || (keep.KeepID & 0xFF) > 150)
                    {
                        KeepCount++;
                    }
                    else
                    {
                        TowerCount++;
                    }
                }
                pak.WriteShort(0x0F00);
                pak.WriteByte((byte)KeepCount);
                pak.WriteByte((byte)TowerCount);
                byte albStr   = 0;
                byte hibStr   = 0;
                byte midStr   = 0;
                byte albMagic = 0;
                byte hibMagic = 0;
                byte midMagic = 0;
                foreach (GameRelic relic in RelicMgr.getNFRelics())
                {
                    switch (relic.OriginalRealm)
                    {
                    case eRealm.Albion:
                        if (relic.RelicType == eRelicType.Strength)
                        {
                            albStr = (byte)relic.Realm;
                        }
                        if (relic.RelicType == eRelicType.Magic)
                        {
                            albMagic = (byte)relic.Realm;
                        }
                        break;

                    case eRealm.Hibernia:
                        if (relic.RelicType == eRelicType.Strength)
                        {
                            hibStr = (byte)relic.Realm;
                        }
                        if (relic.RelicType == eRelicType.Magic)
                        {
                            hibMagic = (byte)relic.Realm;
                        }
                        break;

                    case eRealm.Midgard:
                        if (relic.RelicType == eRelicType.Strength)
                        {
                            midStr = (byte)relic.Realm;
                        }
                        if (relic.RelicType == eRelicType.Magic)
                        {
                            midMagic = (byte)relic.Realm;
                        }
                        break;
                    }
                }
                pak.WriteByte(albStr);
                pak.WriteByte(midStr);
                pak.WriteByte(hibStr);
                pak.WriteByte(albMagic);
                pak.WriteByte(midMagic);
                pak.WriteByte(hibMagic);
                foreach (AbstractGameKeep keep in list)
                {
                    int keepId = keep.KeepID;

                    if (ServerProperties.Properties.USE_NEW_KEEPS == 1 || ServerProperties.Properties.USE_NEW_KEEPS == 2)
                    {
                        keepId -= 12;
                        if ((keep.KeepID > 74 && keep.KeepID < 114) || (keep.KeepID > 330 && keep.KeepID < 370) || (keep.KeepID > 586 && keep.KeepID < 626) ||
                            (keep.KeepID > 842 && keep.KeepID < 882) || (keep.KeepID > 1098 && keep.KeepID < 1138))
                        {
                            keepId += 5;
                        }
                    }

                    int id    = keepId & 0xFF;
                    int tower = keep.KeepID >> 8;
                    int map   = (id / 25) - 1;

                    int index = id - (map * 25 + 25);

                    // Special Agramon zone
                    if ((keep.KeepID & 0xFF) > 150)
                    {
                        index = keep.KeepID - 151;
                    }

                    int    flag  = (byte)keep.Realm;                 // 3 bits
                    Guild  guild = keep.Guild;
                    string name  = "";
                    // map is now 0 indexed
                    pak.WriteByte((byte)(((map - 1) << 6) | (index << 3) | tower));
                    if (guild != null)
                    {
                        flag |= (byte)eRealmWarmapKeepFlags.Claimed;
                        name  = guild.Name;
                    }

                    //Teleport
                    if (m_gameClient.Account.PrivLevel > (int)ePrivLevel.Player)
                    {
                        flag |= (byte)eRealmWarmapKeepFlags.Teleportable;
                    }
                    else
                    {
                        if (GameServer.KeepManager.FrontierRegionsList.Contains(m_gameClient.Player.CurrentRegionID) && m_gameClient.Player.Realm == keep.Realm)
                        {
                            GameKeep theKeep = keep as GameKeep;
                            if (theKeep != null)
                            {
                                if (theKeep.OwnsAllTowers && !theKeep.InCombat)
                                {
                                    flag |= (byte)eRealmWarmapKeepFlags.Teleportable;
                                }
                            }
                        }
                    }

                    if (keep.InCombat)
                    {
                        flag |= (byte)eRealmWarmapKeepFlags.UnderSiege;
                    }

                    pak.WriteByte((byte)flag);
                    pak.WritePascalString(name);
                }
                SendTCP(pak);
            }
        }
示例#2
0
        /*          Relic status
         *
         * Albion Relics:
         * Strength: OwnerRealm
         * Power: OwnerRealm
         *
         * Midgard Relics:
         * Strength: OwnerRealm
         * Power: OwnerRealm
         *
         * Hibernia Relics:
         * Strength: OwnerRealm
         * Power: OwnerRealm
         *
         * Use '/realm' for Realm Info.
         */

        public void OnCommand(GameClient client, string[] args)
        {
            if (IsSpammingCommand(client.Player, "relic"))
            {
                return;
            }

            string albStr = "", albPwr = "", midStr = "", midPwr = "", hibStr = "", hibPwr = "";
            var    relicInfo = new List <string>();

            #region Reformat Relics  '[Type]: [OwnerRealm]'
            foreach (GameRelic relic in RelicMgr.getNFRelics())
            {
                switch (relic.OriginalRealm)
                {
                case eRealm.Albion:
                {
                    if (relic.RelicType == eRelicType.Strength)
                    {
                        albStr = LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Relic.Strength") + ": " + GlobalConstants.RealmToName(relic.Realm);
                    }
                    if (relic.RelicType == eRelicType.Magic)
                    {
                        albPwr = LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Relic.Power") + ": " + GlobalConstants.RealmToName(relic.Realm);
                    }
                    break;
                }

                case eRealm.Midgard:
                {
                    if (relic.RelicType == eRelicType.Strength)
                    {
                        midStr = LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Relic.Strength") + ": " + GlobalConstants.RealmToName(relic.Realm);
                    }
                    if (relic.RelicType == eRelicType.Magic)
                    {
                        midPwr = LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Relic.Power") + ": " + GlobalConstants.RealmToName(relic.Realm);
                    }
                    break;
                }

                case eRealm.Hibernia:
                {
                    if (relic.RelicType == eRelicType.Strength)
                    {
                        hibStr = LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Relic.Strength") + ": " + GlobalConstants.RealmToName(relic.Realm);
                    }
                    if (relic.RelicType == eRelicType.Magic)
                    {
                        hibPwr = LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Relic.Power") + ": " + GlobalConstants.RealmToName(relic.Realm);
                    }
                    break;
                }
                }
            }
            #endregion

            relicInfo.Add(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Relic.AlbRelics") + ":");
            relicInfo.Add(albStr);
            relicInfo.Add(albPwr);
            relicInfo.Add("");
            relicInfo.Add(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Relic.MidRelics") + ":");
            relicInfo.Add(midStr);
            relicInfo.Add(midPwr);
            relicInfo.Add("");
            relicInfo.Add(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Relic.HibRelics") + ":");
            relicInfo.Add(hibStr);
            relicInfo.Add(hibPwr);
            relicInfo.Add("");
            relicInfo.Add(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Relic.UseRealmCommand"));

            client.Out.SendCustomTextWindow(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Relic.Title"), relicInfo);
        }