--金星兑换商 function NPC6040312_OnTalk(MapID, InstanceID, TargetID, TargetTypeID, RoleID, TalkIndex) if TalkIndex == -1 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 200109) --金星兑换商:\n 八星石*1 = 紫星符*1\n 九星石*1 = 紫星符*2\n 十星石*4 = 紫星符*10\n 闪光金粉*75 + 紫星符*5 = 金星符*1 msg.AddMsgEvent(MsgID, 24, TargetID) msg.AddMsgEvent(MsgID, 21, 8) msg.AddMsgEvent(MsgID, 1, 200114) --兑换金星符 msg.AddMsgEvent(MsgID, 21, 9) msg.AddMsgEvent(MsgID, 1, 100002) --“取消” msg.DispatchRoleMsgEvent(RoleID, MsgID) elseif TalkIndex == 8 then if role.GetRoleItemNum(RoleID, 4810154) >= 75 and role.GetRoleItemNum(RoleID, 4820180) >= 5 then local FreeSize = role.GetBagFreeSize(RoleID) if FreeSize > 0 then role.RemoveFromRole(MapID, InstanceID, RoleID, 4810154, 75, 420) role.RemoveFromRole(MapID, InstanceID, RoleID, 4820180, 5, 420) role.AddRoleItem(MapID, InstanceID, RoleID, 4810109, 1, -1, 8, 420) else local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 200115) --背包空间不足 msg.AddMsgEvent(MsgID, 24, TargetID) msg.AddMsgEvent(MsgID, 21, 30) msg.AddMsgEvent(MsgID, 1, 100002) --“取消” msg.DispatchRoleMsgEvent(RoleID, MsgID) end else local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 20, 200116) --金星符兑换商:\n 对不起,你背包中材料不够,不能兑换 msg.AddMsgEvent(MsgID, 24, TargetID) --npcid msg.AddMsgEvent(MsgID, 21, 30) --取消按钮 msg.AddMsgEvent(MsgID, 1, 100002) --“取消” msg.DispatchRoleMsgEvent(RoleID, MsgID) end end end aux.RegisterCreatureEvent(6040312, 7, "NPC6040312_OnTalk")