function chongwuduihuan_OnTalk(MapID, InstanceID, TargetID, TargetTypeID, RoleID, TalkIndex) local silver = role.GetRoleSilver(MapID, InstanceID,RoleID) local bag = role.GetBagFreeSize(RoleID) local agong = role.GetRoleItemNum(RoleID, 4212030) local jieke = role.GetRoleItemNum(RoleID, 4212026) if TalkIndex == -1 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 202011) --宠物兑换商:\n 花金币兑换更高级的宠物。\n 使用一定数目的金币加[宠]水手阿贡[7天]或者[宠]杰克船长[7天],可以兑换更高一级的宠物。 msg.AddMsgEvent(MsgID, 24, TargetID) --npcid msg.AddMsgEvent(MsgID, 21, 4) msg.AddMsgEvent(MsgID, 1, 202012) --兑换水手阿贡 msg.AddMsgEvent(MsgID, 21, 5) msg.AddMsgEvent(MsgID, 1, 202013) --兑换杰克船长 msg.AddMsgEvent(MsgID, 21, 6) msg.AddMsgEvent(MsgID, 1, 100002) msg.DispatchRoleMsgEvent(RoleID, MsgID) elseif TalkIndex == 4 then if bag >= 1 then if agong >=1 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 202014) --宠物兑换商:\n 使用[宠]水手阿贡[7天]加15000金币可以兑换[宠]精准水手阿贡[7天]。\n 使用[宠]水手阿贡[7天]加40000金币可以兑换[宠]精准水手阿贡[30天]。\n 使用[宠]水手阿贡[7天]加200000金币可以兑换[宠]精准水手阿贡[永久]。 msg.AddMsgEvent(MsgID, 24, TargetID) --npcid msg.AddMsgEvent(MsgID, 21, 7) msg.AddMsgEvent(MsgID, 1, 202015) --兑换[宠]精准水手阿贡[7天] msg.AddMsgEvent(MsgID, 21, 8) msg.AddMsgEvent(MsgID, 1, 202016) --兑换[宠]精准水手阿贡[30天] msg.AddMsgEvent(MsgID, 21, 9) msg.AddMsgEvent(MsgID, 1, 202017) --兑换[宠]精准水手阿贡[永久] msg.AddMsgEvent(MsgID, 21, 6) msg.AddMsgEvent(MsgID, 1, 100002) msg.DispatchRoleMsgEvent(RoleID, MsgID) else local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 202025) --你的背包中没有[宠]水手阿贡[7天] msg.AddMsgEvent(MsgID, 24, TargetID) --npcid msg.AddMsgEvent(MsgID, 21, 6) msg.AddMsgEvent(MsgID, 1, 100001) msg.DispatchRoleMsgEvent(RoleID, MsgID) end else local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 202027) --你的背包空间不足一格。 msg.AddMsgEvent(MsgID, 24, TargetID) --npcid msg.AddMsgEvent(MsgID, 21, 6) msg.AddMsgEvent(MsgID, 1, 100001) msg.DispatchRoleMsgEvent(RoleID, MsgID) end elseif TalkIndex == 7 then if silver < 150000000 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 202018) --你的金币不足15000金 msg.AddMsgEvent(MsgID, 24, TargetID) --npcid msg.AddMsgEvent(MsgID, 21, 6) msg.AddMsgEvent(MsgID, 1, 100001) msg.DispatchRoleMsgEvent(RoleID, MsgID) else role.RemoveFromRole(MapID, InstanceID,RoleID,4212030, 1, 400) role.AddRoleItem(MapID, InstanceID, RoleID, 4212038, 1, -1, 8, 420) role.DecRoleSilver(MapID, InstanceID,RoleID,150000000, 420) end elseif TalkIndex == 8 then if silver < 400000000 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 202019) --你的金币不足40000金 msg.AddMsgEvent(MsgID, 24, TargetID) --npcid msg.AddMsgEvent(MsgID, 21, 6) msg.AddMsgEvent(MsgID, 1, 100001) msg.DispatchRoleMsgEvent(RoleID, MsgID) else role.RemoveFromRole(MapID, InstanceID,RoleID,4212030, 1, 400) role.AddRoleItem(MapID, InstanceID, RoleID, 4212039, 1, -1, 8, 420) role.DecRoleSilver(MapID, InstanceID,RoleID,400000000, 420) end elseif TalkIndex == 9 then if silver < 2000000000 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 202020) --你的金币不足200000金 msg.AddMsgEvent(MsgID, 24, TargetID) --npcid msg.AddMsgEvent(MsgID, 21, 6) msg.AddMsgEvent(MsgID, 1, 100001) msg.DispatchRoleMsgEvent(RoleID, MsgID) else role.RemoveFromRole(MapID, InstanceID,RoleID,4212030, 1, 400) role.AddRoleItem(MapID, InstanceID, RoleID, 4212040, 1, -1, 8, 420) role.DecRoleSilver(MapID, InstanceID,RoleID,2000000000, 420) end elseif TalkIndex == 5 then if bag >= 1 then if jieke >= 1 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 202021) --宠物兑换商:\n 使用[宠]杰克船长[7天]加15000金币可以兑换[宠]精准杰克船长[7天]。\n 使用[宠]杰克船长[7天]加40000金币可以兑换[宠]精准杰克船长[30天]。\n 使用[宠]杰克船长[7天]加200000金币可以兑换[宠]精准杰克船长[永久]。 msg.AddMsgEvent(MsgID, 24, TargetID) --npcid msg.AddMsgEvent(MsgID, 21, 10) msg.AddMsgEvent(MsgID, 1, 202022) --兑换[宠]精准杰克船长[7天] msg.AddMsgEvent(MsgID, 21, 11) msg.AddMsgEvent(MsgID, 1, 202023) --兑换[宠]精准杰克船长[30天] msg.AddMsgEvent(MsgID, 21, 12) msg.AddMsgEvent(MsgID, 1, 202024) --兑换[宠]精准杰克船长[永久] msg.AddMsgEvent(MsgID, 21, 6) msg.AddMsgEvent(MsgID, 1, 100002) msg.DispatchRoleMsgEvent(RoleID, MsgID) else local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 202026) --你的背包中没有[宠]杰克船长[7天] msg.AddMsgEvent(MsgID, 24, TargetID) --npcid msg.AddMsgEvent(MsgID, 21, 6) msg.AddMsgEvent(MsgID, 1, 100001) msg.DispatchRoleMsgEvent(RoleID, MsgID) end else local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 202027) --你的背包空间不足一格。 msg.AddMsgEvent(MsgID, 24, TargetID) --npcid msg.AddMsgEvent(MsgID, 21, 6) msg.AddMsgEvent(MsgID, 1, 100001) msg.DispatchRoleMsgEvent(RoleID, MsgID) end elseif TalkIndex == 10 then if silver < 150000000 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 202018) --你的金币不足15000金 msg.AddMsgEvent(MsgID, 24, TargetID) --npcid msg.AddMsgEvent(MsgID, 21, 6) msg.AddMsgEvent(MsgID, 1, 100001) msg.DispatchRoleMsgEvent(RoleID, MsgID) else role.RemoveFromRole(MapID, InstanceID,RoleID,4212026, 1, 400) role.AddRoleItem(MapID, InstanceID, RoleID, 4212034, 1, -1, 8, 420) role.DecRoleSilver(MapID, InstanceID,RoleID,150000000, 420) end elseif TalkIndex == 11 then if silver < 400000000 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 202019) --你的金币不足40000金 msg.AddMsgEvent(MsgID, 24, TargetID) --npcid msg.AddMsgEvent(MsgID, 21, 6) msg.AddMsgEvent(MsgID, 1, 100001) msg.DispatchRoleMsgEvent(RoleID, MsgID) else role.RemoveFromRole(MapID, InstanceID,RoleID,4212026, 1, 400) role.AddRoleItem(MapID, InstanceID, RoleID, 4212035, 1, -1, 8, 420) role.DecRoleSilver(MapID, InstanceID,RoleID,400000000, 420) end elseif TalkIndex == 12 then if silver < 2000000000 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 202020) --你的金币不足200000金 msg.AddMsgEvent(MsgID, 24, TargetID) --npcid msg.AddMsgEvent(MsgID, 21, 6) msg.AddMsgEvent(MsgID, 1, 100001) msg.DispatchRoleMsgEvent(RoleID, MsgID) else role.RemoveFromRole(MapID, InstanceID,RoleID,4212026, 1, 400) role.AddRoleItem(MapID, InstanceID, RoleID, 4212036, 1, -1, 8, 420) role.DecRoleSilver(MapID, InstanceID,RoleID,2000000000, 420) end end end aux.RegisterCreatureEvent(6040203, 7, "chongwuduihuan_OnTalk")