当前位置: 首页>>代码示例>>C#>>正文


C# Player.getLoginDetails方法代码示例

本文整理汇总了C#中WorldServer.player.Player.getLoginDetails方法的典型用法代码示例。如果您正苦于以下问题:C# Player.getLoginDetails方法的具体用法?C# Player.getLoginDetails怎么用?C# Player.getLoginDetails使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WorldServer.player.Player的用法示例。


在下文中一共展示了Player.getLoginDetails方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: patchExists

 public Patch patchExists(Player p, int index)
 {
     foreach(Patch patch in patches) {
         if (patch.getOwnerName().Equals(p.getLoginDetails().getUsername())) {
             if (patch.getPatchIndex() == index) {
                 return patch;
             }
         }
     }
     return null;
 }
开发者ID:Krill156,项目名称:SharpEMU,代码行数:11,代码来源:FarmingPatches.cs

示例2: execute

        public void execute(Player player, string[] arguments)
        {
            if(arguments.Length == 0) {
                player.getPackets().sendMessage("[Yell command]: what are you expecting.. to yell blank message?");
                return;
            }

            string yellMsg = string.Join(" ", arguments);

            foreach(Player p in Server.getPlayerList()) {
                if (p != null) {
                    p.getPackets().sendMessage(player.getLoginDetails().getUsername() + ": " + yellMsg);
                }
            }
        }
开发者ID:Krill156,项目名称:SharpEMU,代码行数:15,代码来源:Yell.cs

示例3: showArnorDialogue

        public static void showArnorDialogue(Player p, int status)
        {
            int newStatus = -1;
            p.getPackets().softCloseInterfaces();
            if (p.getTemporaryAttribute("unmovable") != null) {
                return;
            }
            switch(status) {
                case 370:
                    p.getPackets().sendPlayerHead(64, 2);
                    p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3);
                    p.getPackets().modifyText("Could you take me back to Oo'glog please?", 64, 4);
                    p.getPackets().animateInterface(9827, 64, 2);
                    p.getPackets().sendChatboxInterface2(64);
                    newStatus = 371;
                    break;

                case 371:
                    p.getPackets().sendNPCHead(1361, 241, 2);
                    p.getPackets().modifyText("Arnor", 241, 3);
                    p.getPackets().modifyText("Of course, follow me.", 241, 4);
                    p.getPackets().animateInterface(9827, 241, 2);
                    p.getPackets().sendChatboxInterface2(241);
                    newStatus = 372;
                    break;

                case 372:
                    travel(p, 3, true);
                    break;
            }
            if (newStatus != -1) {
                p.setTemporaryAttribute("dialogue", newStatus);
            }
        }
开发者ID:Krill156,项目名称:SharpEMU,代码行数:34,代码来源:BoatOptions.cs

示例4: showSquireDialogue

        public static void showSquireDialogue(Player p, int status)
        {
            int newStatus = -1;
            p.getPackets().softCloseInterfaces();
            if (p.getTemporaryAttribute("unmovable") != null) {
                return;
            }
            switch(status) {
                case 340:
                    p.getPackets().sendPlayerHead(64, 2);
                    p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3);
                    p.getPackets().modifyText("Could you take me back to Oo'glog please?", 64, 4);
                    p.getPackets().animateInterface(9827, 64, 2);
                    p.getPackets().sendChatboxInterface2(64);
                    newStatus = 341;
                    break;

                case 341:
                    p.getPackets().sendNPCHead(3781, 241, 2);
                    p.getPackets().modifyText("Squire", 241, 3);
                    p.getPackets().modifyText("Certainly! Please visit Pest Control again soon.", 241, 4);
                    p.getPackets().animateInterface(9827, 241, 2);
                    p.getPackets().sendChatboxInterface2(241);
                    newStatus = 342;
                    break;

                case 342:
                    travel(p, 2, true);
                    break;
            }
            if (newStatus != -1) {
                p.setTemporaryAttribute("dialogue", newStatus);
            }
        }
开发者ID:Krill156,项目名称:SharpEMU,代码行数:34,代码来源:BoatOptions.cs

示例5: showJarvaldDialogue

        public static void showJarvaldDialogue(Player p, int status)
        {
            int newStatus = -1;
            p.getPackets().softCloseInterfaces();
            if (p.getTemporaryAttribute("unmovable") != null) {
                return;
            }
            switch(status) {
                case 300:
                    p.getPackets().sendPlayerHead(64, 2);
                    p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3);
                    p.getPackets().modifyText("Could you take me back to Oo'glog please?", 64, 4);
                    p.getPackets().animateInterface(9827, 64, 2);
                    p.getPackets().sendChatboxInterface2(64);
                    newStatus = 301;
                    break;

                case 301:
                    p.getPackets().sendNPCHead(2436, 241, 2);
                    p.getPackets().modifyText("Jarvald", 241, 3);
                    p.getPackets().modifyText("No problem. Off we go!", 241, 4);
                    p.getPackets().animateInterface(9827, 241, 2);
                    p.getPackets().sendChatboxInterface2(241);
                    newStatus = 302;
                    break;

                case 302:
                    travel(p, 1, true);
                    break;
            }
            if (newStatus != -1) {
                p.setTemporaryAttribute("dialogue", newStatus);
            }
        }
开发者ID:Krill156,项目名称:SharpEMU,代码行数:34,代码来源:BoatOptions.cs

示例6: showCaptainBarnabyDialogue

        public static void showCaptainBarnabyDialogue(Player p, int status)
        {
            int newStatus = -1;
            p.getPackets().softCloseInterfaces();
            if (p.getTemporaryAttribute("unmovable") != null) {
                return;
            }
            switch(status) {
                case 410:
                    p.getPackets().sendPlayerHead(64, 2);
                    p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3);
                    p.getPackets().modifyText("Could you take me back to Oo'glog please?", 64, 4);
                    p.getPackets().animateInterface(9827, 64, 2);
                    p.getPackets().sendChatboxInterface2(64);
                    newStatus = 411;
                    break;

                case 411:
                    p.getPackets().sendNPCHead(4962, 241, 2);
                    p.getPackets().modifyText("Captain Barnaby", 241, 3);
                    p.getPackets().modifyText("Yes! it's freezing here, let's go!", 241, 4);
                    p.getPackets().animateInterface(9827, 241, 2);
                    p.getPackets().sendChatboxInterface2(241);
                    newStatus = 412;
                    break;

                case 412:
                    travel(p, 4, true);
                    break;
            }
            if (newStatus != -1) {
                p.setTemporaryAttribute("dialogue", newStatus);
            }
        }
开发者ID:Krill156,项目名称:SharpEMU,代码行数:34,代码来源:BoatOptions.cs

示例7: showCanifisSailorDialogue

        public static void showCanifisSailorDialogue(Player p, int status)
        {
            int newStatus = -1;
            p.getPackets().softCloseInterfaces();
            if (p.getTemporaryAttribute("unmovable") != null) {
                return;
            }
            switch(status) {
                case 280:
                    p.getPackets().sendPlayerHead(64, 2);
                    p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3);
                    p.getPackets().modifyText("Could you take me back to Oo'glog please?", 64, 4);
                    p.getPackets().animateInterface(9827, 64, 2);
                    p.getPackets().sendChatboxInterface2(64);
                    newStatus = 281;
                    break;

                case 281:
                    p.getPackets().sendNPCHead(1304, 241, 2);
                    p.getPackets().modifyText("Sailor", 241, 3);
                    p.getPackets().modifyText("As you wish, i'll fetch the boat.", 241, 4);
                    p.getPackets().animateInterface(9827, 241, 2);
                    p.getPackets().sendChatboxInterface2(241);
                    newStatus = 282;
                    break;

                case 282:
                    travel(p, 0, true);
                    break;
            }
            if (newStatus != -1) {
                p.setTemporaryAttribute("dialogue", newStatus);
            }
        }
开发者ID:Krill156,项目名称:SharpEMU,代码行数:34,代码来源:BoatOptions.cs

示例8: showBentleyDialogue

        public static void showBentleyDialogue(Player p, int status)
        {
            int newStatus = -1;
            p.getPackets().softCloseInterfaces();
            if (p.getTemporaryAttribute("unmovable") != null) {
                return;
            }
            switch(status) {
                case 240:
                    p.getPackets().sendNPCHead(4540, 241, 2);
                    p.getPackets().modifyText("Captain Bentley", 241, 3);
                    p.getPackets().modifyText("Well, hello there " + p.getLoginDetails().getUsername() + ", ready to set sail?", 241, 4);
                    p.getPackets().animateInterface(9827, 241, 2);
                    p.getPackets().sendChatboxInterface2(241);
                    newStatus = 241;
                    break;

                case 241:
                    p.getPackets().modifyText("I'd like to travel to..", 235, 1);
                    p.getPackets().modifyText("Canifis", 235, 2);
                    p.getPackets().modifyText("Waterbirth Isle", 235, 3);
                    p.getPackets().modifyText("Pest Control", 235, 4);
                    p.getPackets().modifyText("Warrior Guild", 235, 5);
                    p.getPackets().modifyText("Fremmenik Shore", 235, 6);
                    p.getPackets().sendChatboxInterface2(235);
                    newStatus = 242;
                    break;

                case 242: // Canifis
                    travel(p, 0, false);
                    break;

                case 243: // Waterbirth isle
                    travel(p, 1, false);
                    break;

                case 244: // Pest control
                    travel(p, 2, false);
                    break;

                case 245: // Warrior guild
                    int attackLevel = p.getSkills().getMaxLevel(Skills.SKILL.ATTACK);
                    int strengthLevel = p.getSkills().getMaxLevel(Skills.SKILL.STRENGTH);
                    bool hasA99 = attackLevel == 99 || strengthLevel == 99;
                    if (((attackLevel + strengthLevel) >= 130) || hasA99) {
                        travel(p, 3, false);
                    } else {
                        p.getPackets().sendNPCHead(4540, 243, 2);
                        p.getPackets().modifyText("Captain Bentley", 243, 3);
                        p.getPackets().modifyText("I'm sorry " + p.getLoginDetails().getUsername() + ", I cannot take you there.", 243, 4);
                        p.getPackets().modifyText("A combined Attack & Strength level of 130 is ", 243, 5);
                        p.getPackets().modifyText("required to use The Warrior Guild.", 243, 6);
                        p.getPackets().animateInterface(9827, 243, 2);
                        p.getPackets().sendChatboxInterface2(243);
                    }
                    break;

                case 246: // Fremmenik shore
                    travel(p, 4, false);
                    break;

            }
            if (newStatus != -1) {
                p.setTemporaryAttribute("dialogue", newStatus);
            }
        }
开发者ID:Krill156,项目名称:SharpEMU,代码行数:66,代码来源:BoatOptions.cs

示例9: recieveWinnings

 public void recieveWinnings(Player p)
 {
     if (!winner.Equals(p)) {
         misc.WriteError(p.getLoginDetails().getUsername() + " tried to claim stake winnings that weren't his.");
         return;
     }
     if (status != 8) {
         return;
     }
     for (int i = 0; i < winnings.Length; i++) {
         if (winnings[i] != null) {
             if (!player.getInventory().addItem(winnings[i].getItemId(), winnings[i].getItemAmount())) {
                 misc.WriteError("Possible stake winnings dupe " + player.getLoginDetails().getUsername());
             } else {
                 winnings[i] = null;
             }
         }
     }
 }
开发者ID:Krill156,项目名称:SharpEMU,代码行数:19,代码来源:DuelSession.cs

示例10: getOfferForSlot

 public GEItem getOfferForSlot(Player p, int slot)
 {
     foreach (KeyValuePair<int, GEItem[]> buyOffer in buyOffers)
     {
         if (buyOffer.Value != null)
         {
             for (int i = 0; i < buyOffer.Value.Length; i++)
             {
                 if (buyOffer.Value[i] != null)
                 {
                     if (buyOffer.Value[i].getPlayerName().Equals(p.getLoginDetails().getUsername()) && buyOffer.Value[i].getSlot() == slot)
                     {
                         return buyOffer.Value[i];
                     }
                 }
             }
         }
     }
     foreach (KeyValuePair<int, GEItem[]> sellOffer in sellOffers)
     {
         if (sellOffer.Value != null)
         {
             for (int i = 0; i < sellOffer.Value.Length; i++)
             {
                 if (sellOffer.Value[i] != null)
                 {
                     if (sellOffer.Value[i].getPlayerName().Equals(p.getLoginDetails().getUsername()) && sellOffer.Value[i].getSlot() == slot)
                     {
                         return sellOffer.Value[i];
                     }
                 }
             }
         }
     }
     return null;
 }
开发者ID:Krill156,项目名称:SharpEMU,代码行数:36,代码来源:GrandExchange.cs

示例11: appendAppearanceUpdate

        private static void appendAppearanceUpdate(Player p, PacketBuilder updateBlock)
        {
            PacketBuilder playerProps = new PacketBuilder().setSize(Packet.Size.Bare);

            Appearance app = p.getAppearance();
            playerProps.addByte((byte) (app.getGender() & 0xFF));
            if((app.getGender() & 0x2) == 2) {
                playerProps.addByte((byte) 0);
                playerProps.addByte((byte) 0);
            }
            playerProps.addByte((byte) p.getPrayers().getPkIcon());
            playerProps.addByte((byte) p.getPrayers().getHeadIcon());
            if (!app.isInvisible()) {
                if(!app.isNpc()) {
                    for(int i = 0; i < 4; i++) {
                        if(p.getEquipment().getItemInSlot((ItemData.EQUIP)i) != -1) {
                            playerProps.addUShort(32768 + p.getEquipment().getSlot((ItemData.EQUIP)i).getDefinition().getEquipId());
                        } else {
                            playerProps.addByte((byte) 0);
                        }
                    }
                    if (p.getEquipment().getItemInSlot(ItemData.EQUIP.CHEST) != -1)
                    {
                        playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.CHEST).getDefinition().getEquipId());
                    } else {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.AMULET));
                    }
                    if (p.getEquipment().getItemInSlot(ItemData.EQUIP.SHIELD) != -1)
                    {
                        playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.SHIELD).getDefinition().getEquipId());
                    } else {
                        playerProps.addByte((byte) 0);
                    }
                    Item chest = p.getEquipment().getSlot(ItemData.EQUIP.CHEST);
                    if (chest != null && chest.getDefinition() != null)
                    {
                        if(!ItemData.isFullBody(chest.getDefinition())) {
                            playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.WEAPON));
                        } else {
                            playerProps.addByte((byte) 0);
                        }
                    } else {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.WEAPON));
                    }
                    if (p.getEquipment().getItemInSlot(ItemData.EQUIP.LEGS) != -1)
                    {
                        playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.LEGS).getDefinition().getEquipId());
                    } else {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.SHIELD));
                    }
                    Item hat = p.getEquipment().getSlot(ItemData.EQUIP.HAT);
                    if (hat != null && hat.getDefinition() != null)
                    {
                        if(!ItemData.isFullHat(hat.getDefinition()) && !ItemData.isFullMask(hat.getDefinition())) {
                            playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.HAT));
                        } else {
                            playerProps.addByte((byte) 0);
                        }
                    } else {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.HAT));
                    }
                    if (p.getEquipment().getItemInSlot(ItemData.EQUIP.HANDS) != -1)
                    {
                        playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.HANDS).getDefinition().getEquipId());
                    } else {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.CHEST));
                    }
                    if (p.getEquipment().getItemInSlot(ItemData.EQUIP.FEET) != -1)
                    {
                        playerProps.addUShort(32768 + p.getEquipment().getSlot(ItemData.EQUIP.FEET).getDefinition().getEquipId());
                    } else {
                        playerProps.addUShort(0x100 + app.getLook(6));
                    }
                    if (hat != null && hat.getDefinition() != null)
                    {
                        if(!ItemData.isFullMask(hat.getDefinition())) {
                            playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.CAPE));
                        } else {
                            playerProps.addByte((byte) 0);
                        }
                    } else {
                        playerProps.addUShort(0x100 + app.getLook(ItemData.EQUIP.CAPE));
                    }
                } else {
                    playerProps.addUShort(-1);
                    playerProps.addUShort(app.getNpcId());
                    playerProps.addByte((byte) 255);
                }
            } else {
                for (int i = 0; i < 12; i++) {
                    playerProps.addByte((byte) 0);
                }
            }
            foreach(int colour in app.getColoursArray()) {
                playerProps.addByte((byte) colour);
            }
            playerProps.addUShort(p.getEquipment().getStandWalkAnimation());
            playerProps.addLong(p.getLoginDetails().getLongName());
            playerProps.addByte((byte) p.getSkills().getCombatLevel());
            playerProps.addUShort(0);
//.........这里部分代码省略.........
开发者ID:Krill156,项目名称:SharpEMU,代码行数:101,代码来源:PlayerUpdate.cs

示例12: showBobDialogue

        public static void showBobDialogue(Player p, int status)
        {
            p.getPackets().softCloseInterfaces();
            int index = -1;
            int newStatus = -1;
            if (p.getTemporaryAttribute("bobsAxesBarrowItem") != null) {
                int item = (int)p.getTemporaryAttribute("bobsAxesBarrowItem");
                index = getIndex(item);
                if (index == -1) {
                    return;
                } else if (item == (int)DATA[index][0]) {
                    p.getPackets().sendNPCHead(BOB_ID, 241, 2);
                    p.getPackets().modifyText("Bob", 241, 3);
                    p.getPackets().modifyText("That item isn't broken..", 241, 4);
                    p.getPackets().animateInterface(9827, 241, 2);
                    p.getPackets().sendChatboxInterface2(241);
                    return;
                } else if (item != (int)DATA[index][1]) {
                    return;
                }
            }
            switch(status) {
                case 101:
                    p.getPackets().sendNPCHead(BOB_ID, 241, 2);
                    p.getPackets().modifyText("Bob", 241, 3);
                    p.getPackets().modifyText("That'll cost you " + ((int)DATA[index][2]).ToString("#,##0") + " gold coins to fix, are you sure?", 241, 4);
                    p.getPackets().animateInterface(9827, 241, 2);
                    p.getPackets().sendChatboxInterface2(241);
                    newStatus = 102;
                    break;

                case 102:
                    p.getPackets().modifyText("Yes, I'm sure!", 557, 2);
                    p.getPackets().modifyText("On second thoughts, no thanks.", 557, 3);
                    p.getPackets().sendChatboxInterface2(557);
                    newStatus = 103;
                    break;

                case 103:
                    p.getPackets().sendPlayerHead(64, 2);
                    p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3);
                    p.getPackets().modifyText("Yes, I'm sure!", 64, 4);
                    p.getPackets().animateInterface(9827, 64, 2);
                    p.getPackets().sendChatboxInterface2(64);
                    newStatus = 104;
                    break;

                case 104:
                    if (!p.getInventory().hasItemAmount(995, (int)DATA[index][2])) {
                        p.getPackets().sendNPCHead(BOB_ID, 241, 2);
                        p.getPackets().modifyText("Bob", 241, 3);
                        p.getPackets().modifyText("You don't have enough money to pay for the repair!", 241, 4);
                        p.getPackets().animateInterface(9827, 241, 2);
                        p.getPackets().sendChatboxInterface2(241);
                        break;
                    } else {
                        if (!p.getInventory().hasItem((int)DATA[index][1])) {
                            p.getPackets().sendNPCHead(BOB_ID, 241, 2);
                            p.getPackets().modifyText("Bob", 241, 3);
                            p.getPackets().modifyText("The item seems to have gone from your inventory.", 241, 4);
                            p.getPackets().animateInterface(9827, 241, 2);
                            p.getPackets().sendChatboxInterface2(241);
                            break;
                        } else if (p.getInventory().deleteItem(995, (int)DATA[index][2])) {
                            p.getInventory().replaceSingleItem((int)DATA[index][1], (int)DATA[index][0]);
                            p.getPackets().sendNPCHead(BOB_ID, 241, 2);
                            p.getPackets().modifyText("Bob", 241, 3);
                            p.getPackets().modifyText("There you go, happy doing business with you!", 241, 4);
                            p.getPackets().animateInterface(9827, 241, 2);
                            p.getPackets().sendChatboxInterface2(241);
                            p.getPackets().sendMessage("You pay Bob his fee and he repairs your " + (string)DATA[index][3] + ".");
                            break;
                        }
                    }
                    break;

                case 105:
                    p.getPackets().sendPlayerHead(64, 2);
                    p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3);
                    p.getPackets().modifyText("On second thoughts, no thanks.", 64, 4);
                    p.getPackets().animateInterface(9827, 64, 2);
                    p.getPackets().sendChatboxInterface2(64);
                    newStatus = 106;
                    break;

                case 106:
                    p.getPackets().sendNPCHead(BOB_ID, 241, 2);
                    p.getPackets().modifyText("Bob", 241, 3);
                    p.getPackets().modifyText("Ok, but don't expect my prices to change anytime soon!", 241, 4);
                    p.getPackets().animateInterface(9827, 241, 2);
                    p.getPackets().sendChatboxInterface2(241);
                    break;

                case 107:
                    p.getPackets().sendNPCHead(BOB_ID, 241, 2);
                    p.getPackets().modifyText("Bob", 241, 3);
                    p.getPackets().modifyText("Hello there " + p.getLoginDetails().getUsername() + ", what can i do for you?", 241, 4);
                    p.getPackets().animateInterface(9827, 241, 2);
                    p.getPackets().sendChatboxInterface2(241);
                    newStatus = 108;
//.........这里部分代码省略.........
开发者ID:Krill156,项目名称:SharpEMU,代码行数:101,代码来源:BrokenBarrows.cs

示例13: showAliDialogue

        public static void showAliDialogue(Player p, int status)
        {
            int newStatus = -1;
            p.getPackets().softCloseInterfaces();
            if (p.getTemporaryAttribute("unmovable") != null) {
                return;
            }
            switch(status) {
                case 205:
                    p.getPackets().sendNPCHead(1862, 241, 2);
                    p.getPackets().modifyText("Ali Morissane", 241, 3);
                    p.getPackets().modifyText("Would you like to go back to Lletya?", 241, 4);
                    p.getPackets().animateInterface(9827, 241, 2);
                    p.getPackets().sendChatboxInterface2(241);
                    newStatus = 206;
                    break;

                case 206:
                    p.getPackets().sendChatboxInterface2(228);
                    p.getPackets().modifyText("Yes please, let's go", 228, 2);
                    p.getPackets().modifyText("Not yet", 228, 3);
                    newStatus = 207;
                    break;

                case 207:
                    p.getPackets().sendPlayerHead(64, 2);
                    p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3);
                    p.getPackets().modifyText("Yes please, let's go.", 64, 4);
                    p.getPackets().animateInterface(9827, 64, 2);
                    p.getPackets().sendChatboxInterface2(64);
                    newStatus = 208;
                    break;

                case 208:
                    p.getPackets().sendNPCHead(1862, 241, 2);
                    p.getPackets().modifyText("Ali Morissane", 241, 3);
                    p.getPackets().modifyText("Very well.", 241, 4);
                    p.getPackets().animateInterface(9827, 241, 2);
                    p.getPackets().sendChatboxInterface2(241);
                    newStatus = 209;
                    break;

                case 209:
                    p.setTemporaryAttribute("unmovable", true);
                    p.getPackets().displayInterface(120);
                    p.getPackets().sendMessage("Your camel trots off slowly out of the desert..");
                    Event moveBackToLletyaEvent = new Event(2000);
                    int moveBackToLletyaCounter = 0;
                    moveBackToLletyaEvent.setAction(() => {
                        if (moveBackToLletyaCounter == 0)
                        {
                            moveBackToLletyaCounter++;
                            moveBackToLletyaEvent.setTick(600);
                            p.teleport(new Location(2340, 3799, 0));
                        } else {
                            moveBackToLletyaEvent.stop();
                            p.removeTemporaryAttribute("unmovable");
                            p.getPackets().sendMessage("..You and Ali are back in Lletya.");
                            p.getPackets().closeInterfaces();
                        }
                    });
                    Server.registerEvent(moveBackToLletyaEvent);
                    break;

                case 210:
                    p.getPackets().sendPlayerHead(64, 2);
                    p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3);
                    p.getPackets().modifyText("Not yet.", 64, 4);
                    p.getPackets().animateInterface(9827, 64, 2);
                    p.getPackets().sendChatboxInterface2(64);
                    newStatus = 211;
                    break;

                case 211:
                    p.getPackets().sendNPCHead(1862, 241, 2);
                    p.getPackets().modifyText("Ali Morissane", 241, 3);
                    p.getPackets().modifyText("No problem, I will be here when you decide to leave.", 241, 4);
                    p.getPackets().animateInterface(9827, 241, 2);
                    p.getPackets().sendChatboxInterface2(241);
                    break;

            }
            if (newStatus != -1) {
                p.setTemporaryAttribute("dialogue", newStatus);
            }
        }
开发者ID:Krill156,项目名称:SharpEMU,代码行数:86,代码来源:AlKharid.cs

示例14: savePlayer

        public bool savePlayer(Player p)
        {
            if (p == null) return false;
            try
            {
                string username = p.getLoginDetails().getUsername().ToLower();

                /* Character saving code goes here */
                XmlTextWriter writer = new XmlTextWriter(misc.getServerPath() + @"\accounts\" + username + ".xml", null);
                writer.Formatting = Formatting.Indented;
                writer.WriteStartElement("Player");
                    writer.WriteStartElement("Login");
                        writer.WriteElementString("Password", p.getLoginDetails().getPassword());
                        writer.WriteElementString("Rights", p.getRights().ToString());
                        writer.WriteElementString("BankPin", p.getBank().getBankPin());
                    writer.WriteEndElement();

                    writer.WriteStartElement("Position");
                        writer.WriteElementString("X", p.getLocation().getX().ToString());
                        writer.WriteElementString("Y", p.getLocation().getY().ToString());
                        writer.WriteElementString("Z", p.getLocation().getZ().ToString());
                    writer.WriteEndElement();

                    writer.WriteStartElement("Settings");
                        writer.WriteElementString("RunEnergy", p.getRunEnergy().ToString());
                        writer.WriteStartElement("PrivacySettings");
                            writer.WriteElementString("Public", p.getFriends().getPrivacyOption(0).ToString());
                            writer.WriteElementString("Private", p.getFriends().getPrivacyOption(1).ToString());
                            writer.WriteElementString("Trade", p.getFriends().getPrivacyOption(2).ToString());
                        writer.WriteEndElement();
                    writer.WriteEndElement();

                    writer.WriteStartElement("Friends");
                        foreach(long friend in p.getFriends().getFriendsList())
                            writer.WriteElementString("Friend", friend.ToString());
                    writer.WriteEndElement();

                    writer.WriteStartElement("Ignores");
                        foreach (long ignore in p.getFriends().getIgnoresList())
                            writer.WriteElementString("Ignore", ignore.ToString());
                    writer.WriteEndElement();

                    writer.WriteStartElement("Stats");
                        foreach (Skills.SKILL skill in Enum.GetValues(typeof(Skills.SKILL))) {
                             writer.WriteStartElement(skill.ToString()); //skill name.
                                writer.WriteElementString("CurrentLevel", p.getSkills().getCurLevel(skill).ToString());
                                writer.WriteElementString("XP", p.getSkills().getXp(skill).ToString());
                            writer.WriteEndElement();
                        }
                    writer.WriteEndElement();

                    Item item;
                    writer.WriteStartElement("EquipmentItems");
                    foreach (ItemData.EQUIP equip in Enum.GetValues(typeof(ItemData.EQUIP))) {
                        if (equip == ItemData.EQUIP.NOTHING) continue;
                        item = p.getEquipment().getSlot(equip);
                        if (item.getItemId() == -1) continue; //empty slot.

                        writer.WriteStartElement(equip.ToString());
                            writer.WriteElementString("Id", item.getItemId().ToString());
                            writer.WriteElementString("Amount", item.getItemAmount().ToString());
                        writer.WriteEndElement();
                    }
                    writer.WriteEndElement();

                    writer.WriteStartElement("InventoryItems");
                        for (int i = 0; i < Inventory.MAX_INVENTORY_SLOTS; i++) {
                            item = p.getInventory().getSlot(i);
                            if (item.getItemId() == -1) continue; //empty slot.

                            writer.WriteStartElement("Item");
                                writer.WriteElementString("Slot", i.ToString());
                                writer.WriteElementString("Id", item.getItemId().ToString());
                                writer.WriteElementString("Amount", item.getItemAmount().ToString());
                            writer.WriteEndElement();
                        }
                    writer.WriteEndElement();

                    writer.WriteStartElement("BankItems");
                    for (int i = 0; i < Bank.MAX_BANK_SLOTS; i++)
                    {
                        item = p.getBank().getSlot(i);
                        if (item.getItemId() == -1) continue; //empty slot.

                        writer.WriteStartElement("Item");
                            writer.WriteElementString("Slot", i.ToString());
                            writer.WriteElementString("Id", item.getItemId().ToString());
                            writer.WriteElementString("Amount", item.getItemAmount().ToString());
                        writer.WriteEndElement();
                    }
                    writer.WriteEndElement();
                writer.WriteEndElement();
                //Write the XML to file and close the writer
                writer.Close();
            }
            catch (Exception)
            {
                return false;
            }

//.........这里部分代码省略.........
开发者ID:Krill156,项目名称:SharpEMU,代码行数:101,代码来源:LoginHandler.cs

示例15: loadPlayer

        public ReturnCode loadPlayer(Connection connection)
        {
            if (connection == null)
                return ReturnCode.COULD_NOT_COMPLETE;
            LoginDetails loginDetails = connection.getLoginDetails();
            if (loginDetails == null || loginDetails.getUsername() == "" || loginDetails.getLongName() == 0)
                return ReturnCode.INVALID_PASSWORD;//ReturnCode.INVALID_PASSWORD;

            foreach (char c in loginDetails.getUsername().ToCharArray())
            {
                if (!char.IsLetterOrDigit(c) && !char.IsWhiteSpace(c))
                    return ReturnCode.INVALID_PASSWORD;
            }
            Player createdPlayer = new Player(connection);
            connection.setPlayer(createdPlayer); //player finally created.
            createdPlayer.setLoginDetails(loginDetails);

            if (!File.Exists(misc.getServerPath() + @"\accounts\" +  loginDetails.getUsername() + ".xml")) {

                createdPlayer.setRights(2); //all new users admins atm (change later).
                createdPlayer.setLocation(new Location(2323, 3174, 0));
                return ReturnCode.LOGIN_OK; //new user.
            }
            //Yeah reading XML files is a bit homo.
            try
            {
                int temp;
                long lTemp;
                string username = createdPlayer.getLoginDetails().getUsername().ToLower();
                XmlDocument xmlDocument = new XmlDocument();
                xmlDocument.Load(misc.getServerPath() + @"\accounts\" + username + ".xml");

                XmlNode xmlNode = xmlDocument.SelectSingleNode("/Player/Login/Password");
                if (xmlNode == null) return ReturnCode.INVALID_PASSWORD; //no password node.
                if (createdPlayer.getLoginDetails().getPassword() != xmlNode.InnerText)
                    return ReturnCode.INVALID_PASSWORD;

                XmlNode loginElement = xmlDocument.SelectSingleNode("/Player/Login");
                if(loginElement != null && loginElement.HasChildNodes) {
                    XmlNodeList childs = loginElement.ChildNodes;

                    foreach (XmlElement element in childs)
                    {
                        switch (element.Name)
                        {
                            case "Rights":
                                if (!int.TryParse(element.InnerText, out temp))
                                    temp = 0;
                                createdPlayer.setRights(temp);
                                break;
                            case "BankPin":
                                if (element.InnerText == "") continue;
                                createdPlayer.getBank().setBankPin(element.InnerText);
                                break;
                        }
                    }
                }

                loginElement = xmlDocument.SelectSingleNode("/Player/Position");
                if (loginElement != null && loginElement.HasChildNodes)
                {
                    XmlNodeList childs = loginElement.ChildNodes;
                    Location location = new Location();
                    foreach (XmlElement element in childs)
                    {
                        switch (element.Name)
                        {
                            case "X":
                                if (!int.TryParse(element.InnerText, out temp)) {
                                    createdPlayer.setLocation(Constants.HOME_SPAWN_LOCATION);
                                    break;
                                }
                                location.setX(temp);
                                break;
                            case "Y":
                                if (!int.TryParse(element.InnerText, out temp)) {
                                   createdPlayer.setLocation(Constants.HOME_SPAWN_LOCATION);
                                    break;
                                }
                                location.setY(temp);
                                break;
                            case "Z":
                                if (!int.TryParse(element.InnerText, out temp))
                                    temp = 0;
                                location.setZ(temp);
                                break;
                        }
                    }
                    createdPlayer.setLocation(location);
                    if (Location.atDuelArena(createdPlayer.getLocation()))
                        DuelSession.teleportDuelArenaHome(createdPlayer);
                }

                xmlNode = xmlDocument.SelectSingleNode("/Player/Settings/RunEnergy");
                if (xmlNode == null)
                {
                    temp = 100;
                } else {
                    if (!int.TryParse(xmlNode.InnerText, out temp))
                        temp = 100;
//.........这里部分代码省略.........
开发者ID:Krill156,项目名称:SharpEMU,代码行数:101,代码来源:LoginHandler.cs


注:本文中的WorldServer.player.Player.getLoginDetails方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。